当前位置:网站首页>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
边栏推荐
- Creating new projects and adding your own programs
- Libgdx learning road 02: draw game map with tiled
- ardupilot软件在环仿真与在线调试
- 智能合约安全——溢出漏洞
- 当CNN遇见Transformer《CMT:Convolutional Neural Networks Meet Vision Transformers》
- 机器学习 --- 模型评估、选择与验证
- 关于白盒测试,这些技巧你得游刃有余~
- 三类6种地图可视化软件测评,最好用的工具居然是它
- RFs self study notes (II): theoretical measurement model - without clutter but with detection probability
- R语言与数据分析实战11-数据的删除
猜你喜欢

About ASM redundancy

Nips18(AD) - 利用几何增广的无监督异常检测《Deep Anomaly Detection Using Geometric Transformations》

Application of time series database in intelligent power consumption field

Qt: 一个SIGNAL绑定多个SLOT

Self-adaptive multi-objective evolutionary algorithm for flexible job shop scheduling with fuzzy pro

【物理应用】水下浮动风力涡轮机的尾流诱导动态模拟风场附matlab代码

Structure and working principle of thyristor

BM16 delete duplicate elements in the ordered linked list -ii

Image processing web application development tutorial

Application value of MES production management system to equipment
随机推荐
【物理应用】水下浮动风力涡轮机的尾流诱导动态模拟风场附matlab代码
Parity rearrangement of Bm14 linked list
PyG搭建异质图注意力网络HAN实现DBLP节点预测
Get to know nodejs for the first time (with cases)
Application of time series database in museum environment detection
【图像分割】基于方向谷形检测实现静脉纹路分割附MATLAB代码
Qt: 一个SIGNAL绑定多个SLOT
[R language - basic drawing]
GPIO port configuration of K60
力扣 1331. 数组序号转换
Photoshop web design practical tutorial
Server body 21: pre compilation processing by different compilers (a brief introduction to MSVC and GCC)
用LEX(FLEX)生成PL语言的词法分析器
Solve the critical path in FJSP - with Matlab source code
sudo rosdep init 出现 ERROR: cannot download default
Streamlit machine learning application development tutorial
What if the content of software testing is too simple?
智能合约安全——溢出漏洞
QT running image
BM16 删除有序链表中重复的元素-II