Answers for "math.floor in js"

30

math.floor js

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: -6
Posted by: Guest on April-06-2020
0

math.round in javascript

let xo =7.45;
xo = Math.round(xo);
// output = 7;
Posted by: Guest on March-17-2020
2

javascript floor

Math.floor(1.6);

result: 1
Posted by: Guest on November-12-2020
3

math floor javascript

// positive
console.log(Math.floor(7.25));   // 7
console.log(Math.floor(0.99));   // 0

// negative
console.log(Math.floor(-2.1));   // -3
console.log(Math.floor(-9.5));   // -10

// objects, strings, functions
console.log(Math.floor("hello"));                     // NaN
console.log(Math.floor({name: 'John', age: '25'}));   // NaN
console.log(Math.floor(console.log));                 // NaN
Posted by: Guest on February-17-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language