Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Round a Number Down in JavaScript</title> </head> <body> <script> document.write(Math.floor(3.5) + "<br>"); // Prints: 3 document.write(Math.floor(-5.7) + "<br>"); // Prints: -6 document.write(Math.floor(9.99) + "<br>"); // Prints: 9 document.write(Math.floor(-9.99) + "<br>"); // Prints: -10 document.write(Math.floor(0)); // Prints: 0 </script> </body> </html>