Mutate an Array Declared with const used Array functions to mutate the array

Had to do it in a short way, excited that it worked

const s = [5, 7, 2];

function editInPlace() {

// Only change code below this line

s.pop();

s.unshift(2)

// Using s = [2, 5, 7] would be invalid

// Only change code above this line

}

editInPlace();

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.