当前位置:网站首页>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]])
},
边栏推荐
- fastjson
- js arguments参数使用和详解
- SQL performance optimization skills
- [wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)
- Take you to quickly learn how to use qsort and simulate qsort
- js如何将秒转换成时分秒显示
- Risc-v-qemu-virt in FreeRTOS_ Lock mechanism analysis of GCC
- What are the reasons for the frequent high CPU of ECS?
- [microservice] Nacos cluster building and loading file configuration
- 接地继电器DD-1/60
猜你喜欢
随机推荐
Thread pool: use thread pool to optimize query speed
Google Chrome browser will support the function of selecting text translation
XII Golang others
C # character similarity comparison general class
RSA加密应用常见缺陷的原理与实践
Canoe panel learning video
Letter meaning and parameter abbreviation of optical module Daquan
Halcon图片标定,使得后续图片处理过后变成与模板图片一样
[Excel] 数据透视图
19.Frambuffer应用编程
Programmers don't talk about morality, and use multithreading for Heisi's girlfriend
如何展开Collapse 的所有折叠面板
Unity2D--人物移动并转身
BUU-Reverse-easyre
What are the reasons for the frequent high CPU of ECS?
ansys命令
Etcd database source code analysis - initialization overview
Appearance of LabVIEW error dialog box
(4) Canal multi instance use
fastjson



![BUU-Crypto-[GXYCTF2019]CheckIn](/img/b8/ad6c05977f6943f30e9975acb6eb6e.jpg)


![[Excel] 数据透视图](/img/45/be87e4428a1d8ef66ef34a63d12fd4.png)


