当前位置:网站首页>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
边栏推荐
- (nowcoder22529c) diner (inclusion exclusion principle + permutation and combination)
- SFTP upload error: com.jcraft.jsch JSchException: connection is closed by foreign host
- Inclusion exclusion principle
- Microcomputer principle and interface technology
- Why does the 20 bit address bus determine the storage space of 1MB
- Rdkit I: using rdkit to screen the structural characteristics of chemical small molecules
- 1.6 example: cifar-10 classification
- 3.解决Pycharm报错Unresolved reference ‘selenium‘ Unresolved reference ‘webdriver‘
- 从2019 年开始,你一定停止使用了这个营销策略…
- How fast does it take to implement a super simple programming language?
猜你喜欢

机器学习【Numpy】

How to understand "page storage management scheme"

EMD 经验模态分解

1. Mx6u driver development-2-led driver

The digitalization of the consumer industry is upgraded to "rigid demand", and weiit's new retail SaaS empowers enterprises!

Flutter 启动白屏

1985-2020(8个版次)全球地表覆盖下载与介绍

Connection broken by 'readtimc rt-443): read timed out (read timeout=l5)“)‘: /pac

1985-2020 (8 Editions) global surface coverage download and introduction

Batch production and upload sales NFT opensea eth polygon
随机推荐
Sleuth+Zipkin 来进行分布式服务链路的追踪
Kotlin companion object vs global function
无法一次粘贴多张图片
一文学透MySQL表的创建和约束
Sleuth+zipkin to track distributed service links
1. Header file - Comment - namespace - standard input / output stream
Why BGP server is used in sunflower remote control? Automatic optimal route and high-speed transmission across operators
I.MX6U-驱动开发-2-LED驱动
(nowcoder22529C)dinner(容斥原理+排列组合)
代码 ~ 隐藏或禁用状态栏和虚拟按键
Code speed optimization
(codeforce547)C-Mike and Foam(质因子+容斥原理)
Deep into C language (3) -- input and output stream of C
Simple use of eventbus
SFTP upload error: com.jcraft.jsch JSchException: connection is closed by foreign host
In depth C language (2) -- definition and use of structure
深入C语言(2)——结构的定义与使用
小马智行进军前装量产,从自研域控制器入手?
Shopify卖家:EDM营销就要搭配SaleSmartly,轻松搞定转化率
路西法98-生活记录ing