Mutate an Array Declared with const not working

Tell us what’s happening:

Your code so far


const s = [5, 7, 2];
function editInPlace() {
  "use strict";
  // change code below this line
  s[0] = [2];
  s[1] = [5];
  s[2] = [7];
  
  // change code above this line
}
editInPlace();

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 OPR/56.0.3051.116.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const

Your code here is trying to put an array into s[0]. when your code is done, s will be [ [2], [5], [7] ], an array of arrays. But you want an array of numbers, [ 2, 5, 7 ]. You need to change your code, so in s[0] = [2];, the right half of that assignment should just be a number.

Thanks… Couldn’t believe that i missed that. I feel so goofy right now

It’s easy to miss. I missed plenty of small things like this as I learned. The lesson is to pay very close attention to every small detail. And if something isn’t working, go over those small details again. This is an important skill for programmers.