Tell us what’s happening:
My code ran correctly. And i understood that by using the array position and declaring a new value was what allowed me to put the correct values in the solution array but I am wondering if there was another way to go about this that would allow me to see the logical insight behind the challenge. I am in the ES6 section of the course now and still find myself confused at certain points so leveling up my understanding of this material is imperative!
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 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const