Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q201 What does the floor() function do?

You are here: irt.org | FAQ | JavaScript | Number | Q201 [ previous next ]

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>

©2018 Martin Webb