当前位置:网站首页>JS array object to object
JS array object to object
2022-06-25 01:44:00 【Э Time walker to me】
Convert the data of an array object into a normal object key value pair key:value In the form of

let arr = [
{
id:'1',employeeNo:'110',name:' Zhang San '},
{
id:'2',employeeNo:'111',name:' Li Si '},
{
id:'3',employeeNo:'112',name:' Wang Wu '},
{
id:'4',employeeNo:'113',name:' Zhang Yu '},
{
id:'5',employeeNo:'114',name:' Xiaohong '},
]
let newObj = {
}
arr.map(item => {
newObj[item.employeeNo] = item.name // It can be spliced according to your own needs
})
console.log(newObj) // {110: ' Zhang San ', 111: ' Li Si ', 112: ' Wang Wu ', 113: ' Zhang Yu ', 114: ' Xiaohong '}
console.log(newObj[112]) // ' Wang Wu '
边栏推荐
- Pbcms adding cyclic digital labels
- 百度语音合成语音文件并在网站中展示
- Unity C# 网络学习(六)——FTP(二)
- Search two-dimensional matrix [clever use of bisection + record solution different from inserting bisection]
- Tianshu night reading notes -- disassembly engine xde32
- Abnova BSG monoclonal antibody description in Chinese and English
- ‘distutils‘ has no attribute ‘version
- PHP 利用getid3 获取mp3、mp4、wav等媒体文件时长等数据
- 音频PCM数据计算声音分贝值,实现简单VAD功能
- 结合实操带你吃透Redis持久化
猜你喜欢

Bi SQL constraints

Google browser console F12 how to set the Chinese / English switching method, we must see the last!!!
![Full arrangement ii[duplicate removal of the same elements + standard backtracking]](/img/d3/93ddb49e580be60be4f056f141b782.png)
Full arrangement ii[duplicate removal of the same elements + standard backtracking]

Application session coverage solutions with different ports on the same server

论文翻译 | RandLA-Net: Efficient Semantic Segmentation of Large-Scale Point Clouds

Baidu voice synthesizes voice files and displays them on the website

(CVPR 2020) Learning Object Bounding Boxes for 3D Instance Segmentation on Point Clouds

Basic knowledge of assembly language (2) -debug

void* 指针

Abnova丨CSV 磁珠中英文说明
随机推荐
Bi-sql - different join
Abnova a4gnt polyclonal antibody
Redis and jedis
JVM指令
Icml2022 | establishing a continuous time model of counterfactual results using neural control differential equations
Search two-dimensional matrix [clever use of bisection + record solution different from inserting bisection]
Unity C # e-learning (VI) -- FTP (I)
Unity C# 网络学习(六)——FTP(二)
Unity C # e-learning (VI) -- FTP (II)
Longest continuous sequence [diffusion method + space for time]
Bi SQL alias
This national day! Tencent cloud wecity will accompany you to travel and light up the city landmark
Application session coverage solutions with different ports on the same server
Bi-sql create
Cloud development technology summit · public welfare programming challenge [hot registration]!
Some Modest Advice for Graduate Students - by Stephen C. Stearns, Ph.D.
sql 聚合函数对 null 的处理[通俗易懂]
CCNP的BGP部分笔记
"One good programmer is worth five ordinary programmers!"
在两个有序数组中找到整体第K小的数可以做到O(log(Min(M,N)))