当前位置:网站首页>js获取对象中嵌套的属性值
js获取对象中嵌套的属性值
2022-07-04 05:29:00 【_处女座程序员的日常】
let data={
b:{
c:{
d:'好好学习'
}
}
};
let arr = ['b','c','d'];
let result = arr.reduce((res,key)=>res[key],data)
console.log("result是");
console.log(result);// 好好学习
// 补充,如何获取arr数组
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]])
},
边栏推荐
- 2022年A特种设备相关管理(电梯)考试题模拟考试平台操作
- Easy change
- How to configure static IP for Kali virtual machine
- LC周赛300
- How to use postman to realize simple interface Association [add, delete, modify and query]
- Canoe panel learning video
- Redis realizes ranking function
- Principle and practice of common defects in RSA encryption application
- BUU-Crypto-[GXYCTF2019]CheckIn
- ANSYS command
猜你喜欢

Upper computer software development - log information is stored in the database based on log4net

小程序毕业设计---美食、菜谱小程序

Simulink与Arduino串口通信

BUU-Pwn-test_ your_ nc

2022危险化学品经营单位安全管理人员上岗证题库及答案

Letter meaning and parameter abbreviation of optical module Daquan

What is MQ?

LM小型可编程控制器软件(基于CoDeSys)笔记二十二:错误4268/4052

C # character similarity comparison general class
![BUU-Crypto-[GUET-CTF2019]BabyRSA](/img/87/157066155e8d3a93e30a68eaf1781b.jpg)
BUU-Crypto-[GUET-CTF2019]BabyRSA
随机推荐
光模块字母含义及参数简称大全
【雕爷学编程】Arduino动手做(105)---压电陶瓷振动模块
SQL injection - injection based on MSSQL (SQL Server)
Notepad++ -- display related configurations
Leetcode 184 Employees with the highest wages in the Department (July 3, 2022)
Nodejs learning document
(4) Canal multi instance use
Principle and practice of common defects in RSA encryption application
VB. Net GIF (making and disassembling - optimizing code, class library - 5)
BUU-Crypto-[GUET-CTF2019]BabyRSA
Use of hutool Pinyin tool
[matlab] general function of communication signal modulation bandpass filter
Programming example of stm32f1 and stm32subeide -74hc595 drives 4-bit 7-segment nixie tube
Li Kou's 300th weekly match
Flask
Accidentally deleted the data file of Clickhouse, can it be restored?
Introduction To AMBA 简单理解
Halcon图片标定,使得后续图片处理过后变成与模板图片一样
[matlab] matlab simulates digital bandpass transmission system ask, PSK, FSK system
Simulink与Arduino串口通信