Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

numbers Math

// 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
Source by practicum.yandex.com #
 
PREVIOUS NEXT
Tagged: #numbers #Math
ADD COMMENT
Topic
Name
8+1 =