|
Q201 What does the floor() function do?
irt.org | Knowledge Base | JavaScript | Number | Q201 [ previous next ]
Q201 What does the floor() function do?
Rounds a number down:
<script language="JavaScript"><!--
alert(Math.floor(0.9)); // returns 0
alert(Math.floor(1.9)); // returns 1
alert(Math.floor(1)); // returns 1
alert(Math.floor(-1.9); // returns -2
alert(Math.floor(-0.01); // returns -1
//--></script>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.