Use the Spread Operator to Evaluate Arrays In-Place bug

Tell us what’s happening:

There seems to be a bug here. This code absolutely uses the spread operator to duplicate the array, but it’s not passing the “Array was duplicated using …arr1”
Your code so far

const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
(function() {
  "use strict";
  arr2 = new Array(...arr1); // change this line

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:

This does not create a copy of arr1.

Try using a literal array with the spread operator. That is the easiest and most readable way.

Old thread, but since it’s not ‘solved’…

This answer confuses me. How does it pass tests 1 and 3 then?


Not sure why I said that, because it actually does create a copy of arr1. I might have been tired that day.

1 Like