Tell us what’s happening:
Describe your issue in detail here.
I don’t understand how the 2nd parameter of .slice method works can someone explain it, I thought it should be 2,3 but for some reason 2,4 works?
Your code so far
function forecast(arr) {
// Only change code below this line
return arr.slice(2,4);
}
// 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/108.0.0.0 Safari/537.36 OPR/94.0.0.0
Challenge: Basic Data Structures - Copy Array Items Using slice()
Link to the challenge: