Mutate an Array Declared with const is not giving output

Mutate an Array Declared with const is not giving output
0

#1

Tell us what’s happening:
I also tried.

Your code so far


const s = [5, 7, 2];
function editInPlace() {
  "use strict";
  // change code below this line
const s = [5, 7, 2];
  
  // s = [2, 5, 7]; <- this is invalid
  s[0] = 2;
  s[1] = 5;
  s[2] = 7;
   return s;

  // change code above this line
}
editInPlace();

Your browser information:

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

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


#2

That looks correct. With your code, I passed. Try submitting again


#3

Okay, I got the problem. First reset you FCC code and only update the code that needs to be changed.

// change code below this line
const s = [5, 7, 2];  // Remove this line
  
  // s = [2, 5, 7]; <- this is invalid
  s[0] = 2;
  s[1] = 5;
  s[2] = 7;
   return s;

  // change code above this line

#4

Still its not working
i’ve remove “return s” instead of not pass the test


#5

Sorry, please check my corrected comment.


#6

@finnabc123
What did your error say?


#7

“s should be equal to [2, 5, 7]”. This is the error Brother.


#8

He has re-declared the const ie const s = [5, 7, 2];


#9

i passed the test, i removed the duplicate dec;ared the array inside the function. Thanks Randore.