// running tests
should be equal to
[2, 5, 7]
. // tests completed
const s = [5, 7, 2];
function editInPlace() {
// Only change code below this line
const s = [2, 5, 7];
function editInPlace() {
"use strict";
s[0] = 2;
s[1] = 5;
s[2] = 7;
}
editInPlace();
// Using s = [2, 5, 7] would be invalid
//how the ****
// Only change code above this line
}
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36.
const s = [5, 7, 2];
function editInPlace() {
// Only change code below this line
const s = [2, 5, 7]; {
"use strict";
s[0] = 2;
s[1] = 5;
s[2] = 7;
}
editInPlace();
// Using s = [2, 5, 7] would be invalid
// Only change code above this line
}
Ok. I would reset your code. Copy-pasting stuff without understanding will not work.
The starter code is this:
const s = [5, 7, 2];
function editInPlace() {
// Only change code below this line
// Using s = [2, 5, 7] would be invalid
// Only change code above this line
}
editInPlace();
You need to put something inside the function that changes s from [5, 7, 2] to [2, 5, 7]. But
s = [2, 5, 7];
would throw an error because s is const.
So you need to update the value at each index in the array one at a time.
is good, but you’ve messed up your code with other stuff. Reset the code to get a fresh start and then put those 3 lines in the right place. If I do that, it passes for me.
The whole point of the exercise is that you must set the individual entries of the array and cannot replace the array because the variable was declared with const.