当前位置:网站首页>Deconstruction assignment of new features of ES6
Deconstruction assignment of new features of ES6
2022-07-29 03:45:00 【Haha, APE】
Deconstruct assignment :ES6 Allow to follow certain mode , Extract values from arrays and objects , Assign values to variables
Frequent use of object methods 、 Array elements , You can use the deconstruction assignment form
Deconstruction and assignment of arrays
const F4 = [" eldest brother "," Second brother "," Three elder brother "," Fourth brother "]
let [a,b,c,d] = F4
// This is equivalent to our statement 4 A variable a b c d The corresponding values are " eldest brother "," Second brother "," Three elder brother "," Fourth brother "
console.log(a,b,c,d);
// Print the results : eldest brother Second brother Three elder brother Fourth brother
Object's deconstruction assignment
const girl = {
name:" Xiao Liu ",
age:24,
sex:" Woman ",
beautifulGirl:function(){
console.log(name+" It's a beautiful girl ");
}
}
let {
name,age,sex,beautifulGirl} = girl
console.log(name,age,sex,beautifulGirl);
// Xiao Liu 24 Woman ƒ (){
// console.log(this.name+" It's a beautiful girl ");
// }
notes : Object deconstruction requires curly braces "{}"
// Method can be used normally
beautifulGirl()
// Running results : Xiao Liu is a beautiful girl
边栏推荐
- Machine learning [numpy]
- (codeforce547)C-Mike and Foam(质因子+容斥原理)
- 1985-2020 (8 Editions) global surface coverage download and introduction
- MOS管 —— 快速复苏应用笔记(贰)[参数与应用]
- 安装抓包证书
- Simple understanding of CDN, SDN and QoS
- "Strangers once met" Summer Street Shen Shuyan_ Xia Mo Shen Shuyan's latest chapter
- Shutter start white screen
- 【redis系列】字符串数据结构
- Kotlin companion object vs global function
猜你喜欢

(2022 Hangdian multi school III) 1002 boss rush (pressure dp+ dichotomy)

1. Mx6u driver development-2-led driver

华为天才少年稚晖君做了一把模块化机械键盘,引起极客圈地震,网友:这才是真正的客制化...

@Configuration (proxybeanmethods = false) what's the use of setting this to false

Simple code implementation of decision tree

EMD empirical mode decomposition

(2022杭电多校三)1011-Link is as bear(思维+线性基)

Solve the problem of garbled code when opening the project code in idea

Why does the 20 bit address bus determine the storage space of 1MB

数字孪生实际应用案例-智慧能源篇
随机推荐
(2022 Hangdian multi school III) 1011 link is as bear (thinking + linear basis)
Division of data link layer, protocols used in data link layer and detailed introduction
Why is continuous integration and deployment important in development?
路西法98-生活记录ing
华为天才少年稚晖君做了一把模块化机械键盘,引起极客圈地震,网友:这才是真正的客制化...
消费行业数字化升级成 “刚需”,weiit 新零售 SaaS 为企业赋能!
Why do programmers so "dislike" the trunk development mode?
小马智行进军前装量产,从自研域控制器入手?
Violence recursion to dynamic programming 01 (robot movement)
Practical application cases of digital Twins - smart energy
Machine learning [numpy]
Shopify seller: EDM marketing should be combined with salesmartly to easily get the conversion rate
最新二开版漫画小说听书三合一完整源码/整合免签接口/搭建教程/带采集接口
从2019 年开始,你一定停止使用了这个营销策略…
1985-2020(8个版次)全球地表覆盖下载与介绍
(nowcoder22529c) diner (inclusion exclusion principle + permutation and combination)
three.js 第五十四用如何给shader传递结构体数组
RHCE的at,crontab的基本操作,chrony服务和对称加密和非对称加密
exness:鸽派决议帮助黄金反弹,焦点转向美国GDP
1. Header file - Comment - namespace - standard input / output stream