I would like to know hot to go about solving this problem in ES6. I tried other methods and I’m here
Your code so far
const s = [5, 7, 2];
function editInPlace() {
// Only change code below this line
s = [2, 5, 7]
s[0] = 2;
s[1] = 5;
a[2] = 7;
console.log(s);
// Only 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/119.0.0.0 Safari/537.36
Using s = [2, 5, 7]; is invalid, the instructions clearly say. You shouldn’t use it. Variables declared using the const keyword cannot be re-assigned but can mutate.
Then replace the a with an s. Just as @anon86258595 suggested.