当前位置:网站首页>JS get the attribute values nested in the object
JS get the attribute values nested in the object
2022-07-04 05:42:00 【_ Virgo programmer's daily life】
let data={
b:{
c:{
d:' study hard '
}
}
};
let arr = ['b','c','d'];
let result = arr.reduce((res,key)=>res[key],data)
console.log("result yes ");
console.log(result);// study hard
// Add , How to get arr Array
getKeys(value){
console.log(Object.keys(value)[0])
if(typeof value =='string') return;
this.arr.push(Object.keys(value)[0]);
this.getKeys (value[Object.keys(value)[0]])
},
边栏推荐
猜你喜欢

Ping port artifact psping

接地继电器DD-1/60

Kubernets first meeting

ETCD数据库源码分析——初始化总览
![BUU-Crypto-[GUET-CTF2019]BabyRSA](/img/87/157066155e8d3a93e30a68eaf1781b.jpg)
BUU-Crypto-[GUET-CTF2019]BabyRSA

谷歌 Chrome 浏览器将支持选取文字翻译功能

SQL injection - injection based on MSSQL (SQL Server)

Build an Internet of things infrared temperature measuring punch in machine with esp32 / rush to work after the Spring Festival? Baa, no matter how hard you work, you must take your temperature first
![[wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)](/img/78/63ab1a8bb1b6e256cc740f3febe711.jpg)
[wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)

The end of the Internet is rural revitalization
随机推荐
Excel comparator
JS string splicing enhancement
Recommended system 1 --- framework
fastjson
接地继电器DD-1/60
The end of the Internet is rural revitalization
卸载Google Drive 硬盘-必须退出程序才能卸载
检漏继电器JY82-2P
left_ and_ right_ Net normal version
Penetration tool - sqlmap
Thread pool: use thread pool to optimize query speed
How much computing power does transformer have
How to configure static IP for Kali virtual machine
Zzulioj:1201: mode problem
2022 question bank and answers for safety management personnel of hazardous chemical business units
tutle时钟改进版
冲击继电器JC-7/11/DC110V
Redis realizes ranking function
(4) Canal multi instance use
Just do it with your hands 7 - * project construction details 2 - hook configuration