展开运算符-复习

	const arry = [2, 4, 6, 8];
    const addArry = [...arry];
    console.log(addArry);
    //控制台输出: (4) [2, 4, 6, 8]
 const obj = {
      name: "ganMr",
      age: 18,
      love: "xuMiss",
    };
    const obj1 = {
      ...obj,
      name: "xuMiss"
    };
    const obj2 = {
      ...obj
    }
    console.log(obj, obj1, obj2, obj2 === obj);//es6-2.html:29 {name: "ganMr", age: 18, love: "xuMiss"} {name: "xuMiss", age: 18, love: "xuMiss"} {name: "ganMr", age: 18, love: "xuMiss"} false
    const obj3 = {
      name: "ganMr",
      age: 18,
      love: "xuMiss",
      address: {
        country: "中国",
        province: "jx",
        city: "fc",
      }
    };
    const obj4 = {
      ...obj3
    }
    console.log(obj3, obj4, obj3.address === obj4.address);//{name: "ganMr", age: 18, love: "xuMiss", address: {…}} {name: "ganMr", age: 18, love: "xuMiss", address: {…}}true
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值