Math.sqrt
Math.random
Math.trunc
0 以上 1 未満の乱数を返します。
Math.random()
아래 값을 입력하면 예제에 즉시 반영됩니다.
const
Math
console
dice
const rand = Math.random(); console.log(rand); // e.g. 0.7234567 // 1~10 사이 정수 const dice = Math.floor(Math.random() * 10) + 1; console.log(dice);