Potential Answer Issue: "Basic Data Structures: Copy Array Items Using slice()"

Tell us what’s happening:

Output is correct, and the function is using the splice command, but the answer isn’t registering as correct.

What am I doing wrong?

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/80.0.3987.149 Safari/537.36.

Challenge: Copy Array Items Using slice()

Link to the challenge:

Hello. The challenge requires the use of the function slice, which is different than splice (the one you are using). I’m sure there are many ways to pass some challenges but a lot of them ask you to use some specific function or method (or more maybe more than one), for them to be passed.

1 Like

Thank you!

When words start to look the same, I might need a break :wink:

1 Like