Cloning Arrays with Spread Operator in Javascript


Create a shallow copy of an array using the spread operator.

Source Code

let original = [1, 2, 3];
let cloned = [...original];
console.log(cloned);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments