javascript floor() method
Translation results:
英[flɔ:(r)] US[flɔr, flor]
n. Floor; ground, floor; bottom; council seat
vt. Flooring; defeat, knock down
Third person singular: floors Plural: floors Present participle: flooring Past tense: floored Past participle: floored
javascript floor() methodsyntax
Function: Round down a number.
Syntax: Math.floor(x)
Parameters: x Required. Any number or expression.
Return: The integer that is less than or equal to x and is closest to x.
Description: The floor() method performs rounding down calculation, and it returns the nearest integer that is less than or equal to the function parameter.
javascript floor() methodexample
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script type="text/javascript"> //在不同的数字上使用 floor() 方法 document.write(Math.floor(0.60) + "<br />") document.write(Math.floor(0.40) + "<br />") document.write(Math.floor(5) + "<br />") document.write(Math.floor(5.1) + "<br />") document.write(Math.floor(-5.1) + "<br />") document.write(Math.floor(-5.9)) </script> </body> </html>
Run instance »
Click the "Run instance" button to view the online instance