Vue — output random Number between 0 and 1

blossom0417
1 min readOct 30, 2018

--

Math.random() // exclusive 1

# between 1 and 10

Math.floor((Math.random() * 10) + 1);

# math.floor() — Round a number downward to its nearest integer:

Math.floor(1.6); 
//1

#math.round() — Round a number to the nearest integer: 올림

Math.round(2.4); // 2
Math.round(2.5); // 3

#toFixed() — Convert a number into a string you desired

var num = 5.56789;
var n = num.toFixed(10); //5.5678900000

--

--

No responses yet