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
That looks correct. With your code, I passed. Try submitting again
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
Still its not working
i’ve remove “return s” instead of not pass the test
Sorry, please check my corrected comment.
@finnabc123
What did your error say?
“s should be equal to [2, 5, 7]”. This is the error Brother.
He has re-declared the const ie const s = [5, 7, 2];
1 Like
i passed the test, i removed the duplicate dec;ared the array inside the function. Thanks Randore.
1 Like
Thanks Man for your time .
Yes you are right