Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Javascript Math

const random = Math.random();
const randomMultiple = random * 10;
console.log(randomMultiple)
const randomFloor = Math.floor(randomMultiple);
console.log(randomFloor);
const randomCeil = Math.ceil(randomMultiple);
console.log(randomCeil)
const randomRound = Math.round(randomMultiple)
console.log(randomRound)

//Output:
// 2.545754647061882 randomMultiple
// 2 randomFloor
// 3 randomCeil
// 3 randomRound 
 
PREVIOUS NEXT
Tagged: #Javascript #Math
ADD COMMENT
Topic
Name
1+8 =