//随机数 var num = Math.ceil(Math.random() * 3) console.log(num); //随机数组 var a = ['1','2','3','4','5']; console.log(a[parseInt(Math.random() * a.length)])