how to floor a number in javascript

JavaScript
console.log(Math.floor(5.95));
// expected output: 5

console.log(Math.floor(5.05));
// expected output: 5

console.log(Math.floor(5));
// expected output: 5

console.log(Math.floor(-5.05));
// expected output: -6Math.floor(x);console.log(Math.floor(5.05));
// expected output: 5

Source

Also in JavaScript: