math.floor
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: -6console.log(Math.floor(5.95));
// expected output: 5
console.log(Math.floor(5.05));
// expected output: 5
// 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)); // NaNconsole.log(Math.floor(5.05));
// expected output: 5
Math.floor(1.6);
result: 1
Also in JavaScript:
- react conditional classname
- json url data is not showing in console using jquery
- How to make remove buttoon on table using js DOM
- how to remove sub array null index in javascript
- json deep dot
- find class
- javascript key pressed enter
- redux saga fetch json
- check if a variable is array in javascript
- javascript change attribute
- remove axis tick ends d3
- how to do a for loop in javascript
- js multiply string
- javascript keep scroll visible
- Discord bot client login
- submit form jquery browser check
- datatables clear table
- js api call
- javascript change color of text input
- jquery loop through list element
- read xlsx file in angular 5
- angular component lifecycle hooks
- javascript toisostring without milliseconds
- get random reddit image link