Articles → JavaScript → Math.floor function in JavaScript

Math.floor function in JavaScript






Purpose




NumberRounding downward to nearest integer
1.81
2.52
3.23



Example


<html>
    <head>
        <title>Math.Floor function demo</title>
        <script>
            alert(Math.floor(2.8));
        </script>
    </head>
    <body></body>
</html>



Output


Picture showing the output of Math.Floor function in JavaScript

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, May 08, 2020

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250