当前位置:网站首页>Update of objects in ES6
Update of objects in ES6
2022-07-28 19:23:00 【ca11meback】
var year=20
var obj={year:year}//{"year":year}
var obj={year}//es6 Object members of can be written as A word This word is the variable name : Take the variable name as the attribute name of the object Value is taken as the attribute value ( Easy to read , Improve the development effect )The writing of objects is more gradual
We are the first to year It is our key the second year Is a variable where the saved value is 20
Functions in objects can also be abbreviated as layh(){} In the form of There's no need to write function
Use obj.layh() Call directly
var obj={name:"bob",age:20,arr:[10,20],life:2}
var obj3={life:7,x:100}
var obj2={life:80,...obj,life:100,...obj3}
console.log(obj2)
console.log(obj2,obj==obj2,obj.arr==obj2.arr)
... Express obj3 All the elements of
边栏推荐
- 关于ASM冗余问题
- 当CNN遇见Transformer《CMT:Convolutional Neural Networks Meet Vision Transformers》
- 三类6种地图可视化软件测评,最好用的工具居然是它
- Getting started with QT & OpenGL
- pytest 自定义HOOK函数
- Wechat official account custom sharing and updateappmessagesharedata are all successful. Why is it a link that is shared?
- Parity rearrangement of Bm14 linked list
- Wechat solves the problem of long press selected style
- Pyg builds heterogeneous graph attention network han to realize DBLP node prediction
- 用LEX(FLEX)生成PL语言的词法分析器
猜你喜欢

C language (high-level) character function and string function + Exercise

【雷达】基于核聚类实现雷达信号在线分选附matlab代码

When unity customizes the editor, let the subclass inherit the inspector display effect of the parent class

Applet applet jump to official account page

SQL审核工具自荐Owls

【图像隐藏】基于DCT、DWT、LHA、LSB的数字图像信息隐藏系统含各类攻击和性能参数附matlab代码

GPIO port configuration of K60

Application of time series database in cigarette factory

How to write a JMeter script common to the test team

Tikz draw Gantt chart in FJSP -trans necessary
随机推荐
JDBC简单封装
TSDB and blockchain
When unity customizes the editor, let the subclass inherit the inspector display effect of the parent class
Libgdx learning road 02: draw game map with tiled
The difference between --save Dev and --save in NPM
Wechat solves the problem of long press selected style
2022年暑假ACM热身练习3(详细)
BM11 链表相加(二)
From Bayesian filter to Kalman filter (I)
[radar] radar signal online sorting based on kernel clustering with matlab code
Asp net MVC web development tutorial
Random finite set RFs self-study notes (6): an example of calculation with the formula of prediction step and update step
Pytorch:快速求得NxN矩阵的主对角线(diagonal)元素与非对角线元素
用于异常检测的Transformer - InTra《Inpainting Transformer for Anomaly Detection》
Application of time series database in museum environment detection
MES生产管理系统对设备的应用价值
More loading in applets (i.e. list paging)
Accumulation and development -- the way of commercialization of open source companies
R language text mining and natural language processing tutorial
After several twists and turns, how long can the TSDB C-bit of influxdb last?