当前位置:网站首页>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)边栏推荐
- Install cuda+cusp environment and create the first helloword starter project
- Tidb certification guide PCTA Pctp
- [redis problem] record a big key problem handling
- Compare advantages and disadvantages of DFS and BFS and name vocabulary
- 【PYTORCH】RuntimeError: one of the variables needed for gradient computation has been
- IIS中的网站访问excel
- C盘爆满?简单几招教你释放、清理C盘几十G空间,最有效的C盘清理方法
- TCP协议的三次握手过程和四次挥手过程以及为什么要这样? ------一二熊猫
- Redis underlying data structure ----quicklist
- 安装CUDA+CUSP环境,并创建第一个HelloWord入门工程
猜你喜欢

Selenium reports an error deprecationwarning: executable_ path has been deprecated, please pass in a Service object

C language: how to give an alias to a global variable?

Consistency under distributed
![[problem record] taberror: inconsistent use of tabs and spaces in indentation](/img/dd/5ba456ac4201c8330d16f4b3bed81d.jpg)
[problem record] taberror: inconsistent use of tabs and spaces in indentation

EHD ether coin, the hottest dpoc mining project
![[problem record] json decoder. JSONDecodeError:Extra data: line xxx column xxx(char xxxx)](/img/29/ec3e5a1566b4c3ecb0eef1ceede98d.jpg)
[problem record] json decoder. JSONDecodeError:Extra data: line xxx column xxx(char xxxx)

比较DFS和BFS的优点和缺点及名称词汇

Redis' underlying data structure -- SDS

GCC compilation process, function library related compilation process

OpenHarmony笔记-----------(一)
随机推荐
25 | adventure and prediction (IV): it's raining today. Will it rain tomorrow?
18 | 建立数据通路(中):指令+运算=CPU
2021-10-08
Shell script Basics
Awk use
udf_ interval_ to_ Hourno() function
Tidb source code series: immersive compilation of tidb
Redis master-slave replication - underlying principle
Advanced MySQL: how to learn MySQL source code
Web site access excel in IIS
China phosphate market in-depth analysis and investment prospect forecast report 2022-2028
2022年G3锅炉水处理操作证考试题库模拟考试平台操作
uniapp 小程序根据权限动态生成 tabbar
Index invalidation caused by inaccurate MySQL statistics
Idea shortcut summary
基于paddlepaddle的新冠肺炎识别
[MySQL] online lock free delay free DDL artifact GH OST
mysql面试题
Redis learning journey sentinel mode
Tidb certification guide PCTA Pctp
