当前位置:网站首页>ES6 deleting an attribute of an object
ES6 deleting an attribute of an object
2022-06-13 07:53:00 【Xizhou-】
1. Do not change the original object
Method 1( Delete age Attribute as an example )
const obj = {
name: 'xingxing',
gender: 'girl',
age: 24
};
const objNew = (({
name,
gender
}) => ({
name,
gender
}))(obj)
console.log(obj)
console.log(objNew)
Output is as follows :
Method 2( Delete age For example )
const obj = {
name: 'xingxing',
gender: 'girl',
age: 24
};
let {age,...objNew} = obj
console.log(objNew)
console.log(obj)
2 delete Delete , Change the original array
Delete age Attribute as an example
let obj = {
name: 'xingxing',
gender: 'girl',
age: 24
};
delete obj.age
console.log(obj)
边栏推荐
- 思路清晰的软光栅小引擎和四元数结合案例
- MySQL interview questions
- Some optimization for seckill project
- JMeter common commands
- How app inventor accesses resource files in assets directory
- udf_ interval_ to_ Hourno() function
- MySQL summary
- Redis learning journey - persistence
- Operation of simulated examination platform for examination question bank of G3 boiler water treatment operation certificate in 2022
- [tools for quickly creating MySQL stand-alone and cluster test environments] dbdeployer
猜你喜欢
Some optimization for seckill project
18 | establish data path (middle): instruction + operation =cpu
TCP协议的三次握手过程和四次挥手过程以及为什么要这样? ------一二熊猫
22 | adventure and prediction (I): hazard is both "danger" and "opportunity"
Data disorder occurs when the n-th row of the subcomponent list generated by V-for is deleted
IDS persistence ---rdb
11.29 Li Kou swipes questions every day
基于paddlepaddle的新冠肺炎识别
C language: how to give an alias to a global variable?
[log4j2 log framework] sensitive character filtering
随机推荐
【PYTORCH】Expected object of type torch. xxxTensor but found type torch. cuda. xxxTensor(torch0.4.0)
[redis problem] record a big key problem handling
【深度学习】:《PyTorch入门到项目实战》(十二)卷积神经网络:填充(padding)和步幅(stride)
[MySQL] the most complete MySQL monitoring project
[pytorch] pytorch0.4.0 installation tutorial and GPU configuration collection (including test code)
Web site access excel in IIS
2021-10-08
Consistency under distributed
String source code analysis
Redis learning journey -- getting to know redis for the first time
获取类的属性
Success logarithm of leetcode spells and potions
Upgrade the project of log4j to log4j2
20 | pipeline oriented instruction design (Part 1): Modern CPU with multi-purpose
Considerations for using redis transactions
18 | 建立数据通路(中):指令+运算=CPU
Redis learning journey - cache exceptions (CACHE penetration, cache avalanche, cache breakdown)
Redis Cluster - the underlying principle of cluster execution commands
2022 electrician (elementary) examination questions and simulation examination
uniapp 小程序根据权限动态生成 tabbar