What is Array.prototype.slice()?

Tell us what’s happening:
what is Array.prototype.slice()?

Your code so far


const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
// Only change code below this line
 // Change this line
 const arr = Array.prototype.slice(1,5);
console.log(arr;
// Only change code above this line
return arr;
}
const arr = removeFirstTwo(source);

Your browser information:

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

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

Link to the challenge:

Hi there,

so when I input Array.prototype.slice to my favorite search engine, the first result goes to MDN.

Is there something you don’t understand after reading this article?

Hey @Hisoka!

I do think you should read up on the slice method because you will need to use it in upcoming algorithm challenges.

However, in the problem the instructions say not to use slice but rather the Destructuring Assignment.

Review the FCC sample and see how you can incorporate that into your answer.
const [a, b, ...arr] = [1, 2, 3, 4, 5, 7];

1 Like

asking on forums is fine for specific problems, but when you are confused about a global qustion or method, always search it up and read before asking, self-study is a really appreciated skill, especially as a developer because there are tons of tools and commands, just google it up