[ Leksykon ] [ JavaScript ] [ Metody ] [ Właściwości ] [ Math() ]
Math.floor()
[_] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z]
Przykłady:
wartosc = (1.921);
typ = String('floor');
console.log(Math[typ](wartosc)); // 1
console.log(Math.floor(2.91)); // 2
console.log(Math.floor(3.25)); // 3
console.log(Math.floor(4)); // 4
console.log(Math.floor(-5.44)); // -6
console.log(Math.floor(-Infinity)); // -Infinity
console.log(Math.floor(-11.88)); // -12
console.log(Math.floor(-11.01)); // -12
console.log(Math.floor(-0)); // -0
console.log(Math.floor(0)); // 0
console.log(Math.floor(11.01)); // 11
console.log(Math.floor(11.88)); // 11
console.log(Math.floor(Infinity)); // Infinity
Opis:
Metoda Math.floor() statyczna zawsze zaokrągla w dół i zwraca największą liczbę całkowitą mniejszą lub równą podanej liczbie. Parametr liczba. Zwracana wartość największa liczba całkowita mniejsza lub równa liczbie parametru. To taka sama wartość jak -Math.ceil(-x).
Linki: