“Liczby matematyczne” Kod odpowiedzi

Liczby matematyczne

parseFloat('98.6'); // 98.6
parseFloat('98.6 is the average normal temperature of the human body'); // 98.6
Cruel Cormorant

Liczby matematyczne

const eightAndAHalf = 8.5;

Number.isInteger(eightAndAHalf); // false
Number.isInteger(Math.floor(eightAndAHalf)); // true
Cruel Cormorant

Liczby matematyczne

// rounds a number down to the nearest integer
Math.floor(9.99); // 9

// rounds a number up to the nearest integer
Math.ceil(9.01); // 10

// rounds a number to the nearest integer
Math.round(9.51); // 10

// returns the largest of the numbers passed through it
Math.max(1, 2, 3, 4, 5); // 5

// returns the smallest of the numbers passed through it
Math.min(1, 2, 3, 4, 5); // 1

// returns a random number between 0 inclusive and 1 non-inclusive
Math.random(); // 0.31764219954126016
Cruel Cormorant

Liczby matematyczne

parseInt("100", 10); // 100
parseInt("100", 2); // 4 (100 in the binary system)
Cruel Cormorant

Odpowiedzi podobne do “Liczby matematyczne”

Pytania podobne do “Liczby matematyczne”

Więcej pokrewnych odpowiedzi na “Liczby matematyczne” w JavaScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu