![]() ![]() ![]() However, somewhat confusingly, by using the arrayOneSlice notation, Javascript interprets this as putting a new value into the place of the shallow copy itself. In the first example, using the ems notation, Javascript interprets this as updating an existing element within the shallow copy and thus it affects the original. Wait, what? We changed arrayOneSlice’s items object, but its changed in both arrayOne and arrayOneSlice! Meanwhile, arrayOneSlice has only changed arrayOneSlice! Welcome to another Javascript quirk.
0 Comments
Leave a Reply. |