当前位置:网站首页>ES6解构语法详解
ES6解构语法详解
2022-07-01 03:08:00 【勇敢小陈】
ES6的解构语法简化了我们开发过程中复杂的取值过程,可能你在a.b.c.d的时候别人早就把值一开始就取出来了,使代码更加简洁。下面开始进行语法的详解。
一、单层解构
单层解构
const earth = {
people: '人类',
animal: '动物'
}
const { people, animal } = earth
console.log(people, animal);//人类 动物单层解构并更改变量名称
const earth = {
people: '人类',
animal: '动物'
}
const { people: ren, animal } = earth
console.log(ren, animal);//人类 动物二、多层解构
多层数据解构
const earth = {
people: {
male:'男',
female:'女'
},
animal: '动物'
}
const {people:{male,female}}=earth
console.log(male,female);多层解构并更改变量名称
const earth = {
people: {
male:'男',
female:'女'
},
animal: '动物'
}
const {people:{male:man,female}}=earth
console.log(man,female);2022.06.29
边栏推荐
- Hal library setting STM32 interrupt
- Completely solve the lost connection to MySQL server at 'reading initial communication packet
- php批量excel转word
- [applet project development -- JD mall] uni app commodity classification page (first)
- A shooting training method based on the digital measurement of Joule energy and posture of sphygmomanometer air bag with standard air pressure
- Magnetic manometer and measurement of foreign coins
- Introduction and basic knowledge of machine learning
- An article explaining the publisher subscriber model and the observer model
- HTB-Lame
- Dart training and sphygmomanometer inflation pump power control DPC
猜你喜欢

Hello World generation

Communication protocol -- Classification and characteristics Introduction

Example of Huawei operator level router configuration | example of configuring optionc mode cross domain LDP VPLS

So easy deploy program to server

8 pits of redis distributed lock
![Od modify DLL and exe pop-up contents [OllyDbg]](/img/ff/7249e6e6644376ae048b23bf63b046.jpg)
Od modify DLL and exe pop-up contents [OllyDbg]

Redis分布式锁的8大坑

EDLines: A real-time line segment detector with a false detection control翻译

【小程序项目开发-- 京东商城】uni-app之首页商品楼层

MCU firmware packaging Script Software
随机推荐
Introduction to core functions of webrtc -- an article on understanding SDP PlanB unifiedplan (migrating from PlanB to unifiedplan)
Huawei operator level router configuration example | BGP VPLS configuration example
咱就是说 随便整几千个表情包为我所用一下
Subnet division and subnet summary
Here comes the share creators budding talent training program!
How the network is connected: Chapter 2 (Part 2) packet receiving and sending operations between IP and Ethernet
Scale SVG to container without mask / crop
pytest-fixture
PTA 1016
Classic programming problem: finding the number of daffodils
基于Pytorch完整的训练一个神经网络并进行验证
【读书笔记】《文案变现》——写出有效文案的四个黄金步骤
STM32——一线协议之DS18B20温度采样
Kmeans
How do spark tasks of 10W workers run? (Distributed Computing)
一文讲解发布者订阅者模式与观察者模式
[reading notes] copywriting realization -- four golden steps for writing effective copywriting
最好用的信任关系自动化脚本(shell)
Nacos
Const and the secret of pointers