const source1 = { a: 123, b: 555 };
const source2 = { g: 444, y: 6567, a: 89 };
const target = { a: 345, b: 666, v: 77 };
const targetSelf = Object.assign(target, source1, source2);
console.log("targetSelf", targetSelf, targetSelf === target);
function fn(obj) {
const _obj = Object.assign({}, obj);
_obj.a.name = 1;
console.log(_obj, obj);
}
const obj = { a: { name: 5 } };
fn(obj);
console.log("Object.is()", Object.is(NaN, NaN), Object.is(-0, +0));
console.log("===", NaN === NaN, -0 === +0);
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28