1 Star 0 Fork 0

math.most/js_study

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
023合并对象.js 275 Bytes
一键复制 编辑 原始数据 按行查看 历史
math.most 提交于 2021-08-22 16:17 +08:00 . 增加某些东西
/**
* 合并对象
*/
// Object.assign
const obj1 = {a: 1}
const obj2 = {b: 2}
console.log(Object.assign(obj1, obj2)) // { a: 1, b: 2 }
// 简洁方式: 也就是通过spread operator来实现
const CombinObj = {...obj1, ...obj2}
console.log(CombinObj) // { a: 1, b: 2 }
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mathmost/js_study.git
git@gitee.com:mathmost/js_study.git
mathmost
js_study
js_study
master

搜索帮助