当前位置:网站首页>JS array random value (random array value)
JS array random value (random array value)
2022-06-28 02:10:00 【The most ferocious little seal】
principle : Get by random numbers [0, The length of the array ] Key value of , Then directly get the array value corresponding to the key .
Be careful : The following code applies to one-dimensional arrays , Multidimensional arrays extend themselves !
function randomArr(arr){
return arr[parseInt(Math.random() * arr.length, 10)]
}
var color_arr = ['#00ff089e', '#0043ff9e', '#fff7009e', '#ff00009e'];
console.log(' Random color values :', randomArr(color_arr));
边栏推荐
- 机器学习笔记 - 时间序列作为特征
- [Yocto RM] 2 - Yocto Project Terms
- What are the risks of opening a compass stock account? Is it safe to open a compass account
- pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...
- Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)
- Capacitor
- Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)
- 如何高效读书学习
- Lmsoc: a socially sensitive pre training method
- 利用redis bitmap实现人员在线情况监控
猜你喜欢

嵌入式必学!硬件资源接口详解——基于ARM AM335X开发板 (下)

将某数据库N多表名作为另外一张表中某一列得值(范围可以是别的数据库中得某张表)

Intranet penetration with FRP

要搞清楚什么是同步,异步,串行,并行,并发,进程,线程,协程

Numpy----np.meshgrid()

Ten thousand words long article understanding business intelligence (BI) | recommended collection
![pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...](/img/b4/8921c3ca5cd5a547768489d4a79202.png)
pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...

Data analysts too hot? Monthly income 3W? Tell you the true situation of this industry with data

Overview of drug discovery-01 overview of drug discovery

嵌入式必学,硬件资源接口详解——基于ARM AM335X开发板 (上)
随机推荐
Import the data table in MySQL into Excel
药物发现综述-03-分子设计与优化
Shardingsphere-proxy-5.0.0 establish MySQL read / write separation connection (6)
基于可学习尺寸自适应分子亚结构的药物相互作用预测
Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)
Using redis bitmap to realize personnel online monitoring
零基礎多圖詳解圖神經網絡
How to understand query, key and value in transformer
Appium自动化测试基础 — ADB常用命令(一)
How to read a paper
如何高效读书学习
MapReduce elementary programming practice
Cesium 点击获取经纬度(二维坐标)
ionic4实现半星评分
Neural network of zero basis multi map detailed map
Numpy----np.reshape()
What is digitalization? What is digital transformation? Why do enterprises choose digital transformation?
评价——秩和比综合评价
如何阅读一篇论文
The practice of dual process guard and keeping alive in IM instant messaging development