Correct answer marked incorrect (Copy an Array with the Spread Operator)

Tell us what’s happening:
The answer checker doesn’t consider that a coding style might insert whitespace after the spread operator, so ... arr is marked as incorrect.

Your code so far

function copyMachine (arr, num) {
  let newArr = [];
  while (num >= 1) {
    // Only change code below this line
    newArr.push([ ... arr ]);
    // Only change code above this line

    num --;

  return newArr;

console.log(copyMachine([true, false, true], 2));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic Data Structures - Copy an Array with the Spread Operator

Link to the challenge:

Aha, you’re right. It’s due to the regex used in the test (there to ensure you’re actually using the spread operator) being too strict: I’ve submitted an issue here and mentioned this thread if that’s ok?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.