/
floor.xml
39 lines (37 loc) · 1.35 KB
/
floor.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../../../template/methodWrapper.xsl"?>
<method name="floor" parent="Math" xmlns="http://www.jsman.net/xsd/manual"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jsman.net/xsd/manual ../../../../schema/jsman-manual.xsd">
<lead>
<p>floor — Rounds down to the closest whole number.</p>
</lead>
<description>
<p>Math.floor(<params/>)</p>
</description>
<parameters>
<parameter name="number" type="number" optional="false"></parameter>
</parameters>
<examples>
<example>
<heading>floor example</heading>
<code>
console.log(Math.floor(1)); // 1
console.log(Math.floor(1.0)); // 1
console.log(Math.floor(1.2)); // 1
console.log(Math.floor(1.49)); // 1
console.log(Math.floor(1.5)); // 1
console.log(Math.floor(1.8)); // 1
console.log(Math.floor(2)); // 2
</code>
</example>
</examples>
<see-also>
<ul>
<li><p><xref href="manual/1. Standard Global Objects/Math/2.2. ceil/ceil.xml">ceil</xref></p></li>
<li><p><xref href="manual/1. Standard Global Objects/Math/2.1. round/round.xml">round</xref></p></li>
</ul>
</see-also>
<external>
<mdn href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/floor">Math.floor method</mdn>
</external>
</method>