Math.random()
回傳0~1(不包含1)的數字

Math.floor()
去除小數,取得整數

Math.floor(Math.random()*5);
取得0~4的隨機數字

創作者介紹
創作者 前端生涯 的頭像
浣熊

前端生涯

浣熊 發表在 痞客邦 留言(0) 人氣( 87 )