I saw the solution in hint my doubt is what is 'use strict ' mode doing here. PLEASE help me out

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

  **Your code so far**

const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo([a,b,...subarr]) {
// Only change code below this line

 
const arr = subarr; // Change this line
// Only change code above this line
return arr;
}
const arr = removeFirstTwo(source);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge: Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements

Link to the challenge:

"use strict"; is an optional flag for the JS compiler. It tells it to be extra strict.

One criticism of JS is that it is not strict enough, it let’s you do “questionable” things, like accessing a variable before it is declared. It may also speed up the code a bit and make it more forward compatible.

You can read about it here.

thanks for reply,but my solution not accepted but the output come. please compare mine and freecodecamp code and explain, please

Hi @peruris80 !

You don’t need to have "use strict";.
That is not your issue.

You are failing the test because you changed the wrong part of the code.

Reset the lesson and only change this line.

 const arr = list; // Change this line

Take a very close look at the example code again on how to use destructing for this part here

const arr

That is the only part you should be changing.

The example code shows you the answer.

Hope that helps!

1 Like

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