-3
好了,所以这是代码:如何在0-2之间生成一个整数?
var i = prompt('Rock, Paper or scissors?');
var b = ['Rock', 'Paper', 'Scissors'];
现在,我需要生成(纠正我,如果我错了请)0-2之间的号码。我的想法是(嗯,是):
var i = prompt('Rock, Paper or scissors?');
var b = ['Rock', 'Paper', 'Scissors'];
document.write(Math.random(0, 2));
var c = //the code I can't figure out
document.write(b[c]);
有什么想法?
'Math.floor(的Math.random()*(最大 - 最小+ 1)+分)'所以'Math.floor( Math.random()* 3)'! –