Why this shortcut didn't work?

Tell us what’s happening:

Your code so far


const s = [5, 7, 2];
function editInPlace() {
// Only change code below this line

// Using s = [2, 5, 7] would be invalid
 s[5, 7, 2] = [2, 5, 7];
// Only change code above this line
}
editInPlace();

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 13505.100.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.142 Safari/537.36.

Challenge: Mutate an Array Declared with const

Link to the challenge:

That syntax is not valid, but if it was, the only way to interpret it is that you want to replace the data at indices 5, 7, and 2 of your array, which isn’t what you want.

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