📜  math floor javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:31.640000             🧑  作者: Mango

代码示例4
// 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