scrimba
Learn Modern JavaScript
Use the Spread Operator to Evaluate Arrays In-Place
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Use the Spread Operator to Evaluate Arrays In-Place
AboutCommentsNotes
Use the Spread Operator to Evaluate Arrays In-Place
Expand for more info
index.js
run
preview
console
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
(function() {
arr2 = arr1; // change this line
arr1[0] = 'potato'
})();
console.log(arr2);
Console
[
"JAN"
,
"FEB"
,
"MAR"
,
"APR"
,
"MAY"
]
,
index.html
-1:43