foo = foo.slice();
This is obviously different from the way to approach an object like so:
foo = Object.assign({}, foo);
In TypeScript you would approach the object issue like so:
foo = { ...foo };
What is the difference between .splice() and .slice() in JavaScript? They both return a chunk of the array, but the slice leaves the original unedited while the splice will remove from the first array the part it hands back from its returning.
No comments:
Post a Comment