标签:let kill func assign sign 赋值 log 相等 对象
let name='zhang';
let age=30;
let obj={name,age};
console.log(obj);//{name: "zhang", age: 30}
let key='skill';
var obj={
[key]:'web'
};
console.log(obj)//{skill: "web"}
let obj={
add:function(a,b){
return a+b;
}
};
console.log(obj.add(1,2));//3
let obj1={'name':'zhang'};
let obj2={'name':'zhang'};
console.log(obj1.name===obj2.name);//true
console.log(Object.is(obj1.name,obj2.name));//true
//===同值相等,is严格相等
console.log(+0===-0);//true
console.log(NaN===NaN);//false
console.log(Object.is(+0,-0));//false
console.log(Object.is(NaN,NaN));//true
let a={a:'zhang'};
let b={b:'huan'};
let c={c:'ok'};
let obj=Object.assign(a,b,c);
console.log(obj);
标签:let kill func assign sign 赋值 log 相等 对象
原文地址:https://www.cnblogs.com/eternityz/p/12272444.html