当前位置:网站首页>Detailed explanation of ES6 deconstruction grammar
Detailed explanation of ES6 deconstruction grammar
2022-07-01 03:21:00 【Brave Xiao Chen】
ES6 The deconstruction syntax of simplifies the complex value taking process in our development process , May you in a.b.c.d Others have already taken out the value from the beginning , Make the code more concise . Now let's start to explain the grammar in detail .
One 、 Monolayer deconstruction
Monolayer deconstruction
const earth = {
people: ' human beings ',
animal: ' animal '
}
const { people, animal } = earth
console.log(people, animal);// human beings animal
Single layer deconstructs and changes the variable name
const earth = {
people: ' human beings ',
animal: ' animal '
}
const { people: ren, animal } = earth
console.log(ren, animal);// human beings animal
Two 、 Multi level deconstruction
Multi level data deconstruction
const earth = {
people: {
male:' male ',
female:' Woman '
},
animal: ' animal '
}
const {people:{male,female}}=earth
console.log(male,female);
Multi level deconstruction and change variable names
const earth = {
people: {
male:' male ',
female:' Woman '
},
animal: ' animal '
}
const {people:{male:man,female}}=earth
console.log(man,female);
2022.06.29
边栏推荐
- Force buckle - sum of two numbers
- Edge Drawing: A combined real-time edge and segment detector 翻译
- 【日常训练】1175. 质数排列
- Redis tutorial
- POI exports excel and displays hierarchically according to parent-child nodes
- 第03章_用戶與權限管理
- 【小程序项目开发--京东商城】uni-app之自定义搜索组件(上)
- 线程数据共享和安全 -ThreadLocal
- Introduction and installation of Solr
- Best used trust automation script (shell)
猜你喜欢
Network address translation (NAT) technology
Example of Huawei operator level router configuration | example of configuring optionc mode cross domain LDP VPLS
Data exchange JSON
Kmeans
【小程序项目开发 -- 京东商城】uni-app 商品分类页面(上)
Huawei operator level router configuration example | configuration static VPLS example
Edge Drawing: A combined real-time edge and segment detector 翻译
EtherCAT简介
So easy 将程序部署到服务器
[applet project development -- Jingdong Mall] classified navigation area of uni app
随机推荐
HTB-Lame
Redis 教程
Huawei operator level router configuration example | BGP VPLS configuration example
[exsi] transfer files between hosts
Overview of EtherCAT principle
Cookie&Session
【小程序项目开发--京东商城】uni-app之自定义搜索组件(上)
Network address translation (NAT) technology
Hello World generation
About the application of MySQL
leetcode 1482 猜猜看啊,这道题目怎么二分?
【Qt】添加第三方库的知识补充
C语言多线程编程入门学习笔记
How to verify whether the contents of two files are the same
ctfshow爆破wp
LeetCode_栈_困难_227.基本计算器(不含乘除)
Data exchange JSON
LeetCode_ Stack_ Difficulties_ 227. basic calculator (excluding multiplication and division)
Introduction to the core functions of webrtc -- an article to understand peerconnectionfactoryinterface rtcconfiguration peerconnectioninterface
XXL job User Guide