作业帮 > 综合 > 作业

index = Math.floor(Math.random() * tips.length);什么意思

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/07/01 07:33:44
index = Math.floor(Math.random() * tips.length);什么意思
index = Math.floor(Math.random() * tips.length);什么意思.具体点阿!
index = Math.floor(Math.random() * tips.length);什么意思
tips.length--tips对象的length属性,估计返回整数啊
Math.random()--求随机数啊
Math.floor--向下取整啊
也就是说:假设tips有从1到n的计数属性,则index取从1到n中的任意一个值.