当前位置:网站首页>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]])
},
边栏推荐
- How to configure static IP for Kali virtual machine
- Accidentally deleted the data file of Clickhouse, can it be restored?
- transformer坑了多少算力
- 冲击继电器JC-7/11/DC110V
- One click filtering to select Baidu online disk files
- Analysis of classical pointer and array written test questions in C language
- win10清除快速访问-不留下痕迹
- BUU-Pwn-test_ your_ nc
- Void convolution, deformable convolution, deformable ROI pooling
- 509. Fibonacci number, all paths of climbing stairs, minimum cost of climbing stairs
猜你喜欢
Integer type of C language
VB. Net GIF (making and disassembling - optimizing code, class library - 5)
Steady! Huawei micro certification Huawei cloud computing service practice is stable!
2022 a special equipment related management (elevator) examination questions simulation examination platform operation
1480. Dynamic sum of one-dimensional array
BUU-Reverse-easyre
Solar insect killing system based on single chip microcomputer
JS扁平化数形结构的数组
ETCD数据库源码分析——初始化总览
Signification des lettres du module optique et abréviation des paramètres Daquan
随机推荐
The end of the Internet is rural revitalization
19.Frambuffer应用编程
Character types of C language
补某视频网站的js,进行视频解密
空洞卷积、可变形卷积、可变形ROI Pooling
Letter meaning and parameter abbreviation of optical module Daquan
Thread pool: use thread pool to optimize query speed
Actual cases and optimization solutions of cloud native architecture
input显示当前选择的图片
SQL injection - injection based on MSSQL (SQL Server)
What are the reasons for the frequent high CPU of ECS?
fastjson
Kubernets first meeting
left_and_right_net可解释性设计
How much computing power does transformer have
1.1 history of Statistics
ETCD数据库源码分析——初始化总览
Google Chrome browser will support the function of selecting text translation
XII Golang others
C语言简易学生管理系统(含源码)