Basic Data Structures - Copy Array Items Using slice()

Tell us what’s happening:

I think there is some back end problem, after repeated use of slice in different ways to get the result, the task is not getting completed. Can anyone check it internally why the return of the correct answer is not finishing this challenge.

Your code so far

function forecast(arr) {
  // Only change code below this line
 return arr.splice(2,2);
}

// Only change code above this line
console.log(forecast(['cold', 'rainy', 'warm', 'sunny', 'cool', 'thunderstorms']));

Your browser information:

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

Challenge Information:

Basic Data Structures - Copy Array Items Using slice()

Code shared by you is using splice method, instead of slice, is that intended?

1 Like