JS取1到10的随机整数函数

输出0~10之间的随机整数

alert(parseInt(10*Math.random()));

输出1~10之间的随机整数

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