what is Math.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: math.floor

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

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

Example 3: javascript floor

Math.floor(1.6);

result: 1

Example 4: math.floor

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

Example 5: math.floor + roandom

//Write the following code to get a random number between 1 and 10
       const result = Math.floor(Math.random()*(10)+ 1);

Example 6: 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