Mutate an Array Declared with const

 avatar
unknown
plain_text
2 years ago
124 B
7
Indexable
const s = [5, 7, 2];
function editInPlace() {
  s.unshift(s[2]); 
  s.pop();
  return s;
}
console.log(editInPlace());
Editor is loading...