javascript floor() code example
Example 1: 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
Example 2: js trim()
var str = ' foo ';
console.log(str.trim()); // retorna 'foo'
// Outro exemplo de .trim() removendo whitespace de
// apenas um lado.
var str= 'foo ';
console.log(str.trim()); // retorna 'foo'