ES6 - Mutate an Array Declared with const

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

const s = [5, 7, 2];
function editInPlace() {
  // Only change code below this line
  "use strict";
  s.splice[2, 1];
  s.unshift(2);
  // Using s = [2, 5, 7] would be invalid

  // 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/115.0.0.0 Safari/537.36 Edg/115.0.1901.188

Challenge: ES6 - Mutate an Array Declared with const

Link to the challenge:

What is the issue in my code, I can’t understand? Please help me!

This is not how splice is used. You need () instead of [ ]

1 Like

Thanks sir :heart:. Thanksyou so much

2 Likes

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