mirror of
https://github.com/m-lamonaca/dev-notes.git
synced 2025-04-08 11:56:41 +00:00
Spread operator cloning improvements
This commit is contained in:
parent
6af14dff5a
commit
5dff3ab7c9
1 changed files with 1 additions and 1 deletions
|
@ -444,7 +444,7 @@ let merge = [ ...array1, ...attay2 ]; // merge the arrays contents in new array
|
||||||
|
|
||||||
// objects
|
// objects
|
||||||
let obj = { prop1: value1, prop2: value2 };
|
let obj = { prop1: value1, prop2: value2 };
|
||||||
let clone = { ...obj };
|
let clone = { ...obj, prop: value }; // shallow copy, and update copy prop
|
||||||
let cloneAndAdd = { prop0: value0, ...obj, prop3: value3 };
|
let cloneAndAdd = { prop0: value0, ...obj, prop3: value3 };
|
||||||
|
|
||||||
// strings
|
// strings
|
||||||
|
|
Loading…
Add table
Reference in a new issue