Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.