我是
靠谱客的博主
唠叨抽屉,这篇文章主要介绍
js数组中随机取值,现在分享给大家,希望可以做个参考。
数组中随机取值
let aa=[1,2,3,4,5,6,7,8];
let result= Math.floor(Math.random() * aa.length);
console.log(result)
1到100随机数获取
let result=Math.floor((Math.random()*100)+1)
console.log(result)
最后
以上就是唠叨抽屉最近收集整理的关于js数组中随机取值的全部内容,更多相关js数组中随机取值内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复