JS Basics / Fundamentals Part 4 / removeFromArray.js


#1

Hello everyone. I am a total noob and I am struggling with javascript. I have found the difficulty spike once you reach the JavaScript Basics section to be jarring. However, I am committed and determined to learn it.

In JS Basics, Fundamentals Part 4, I was ultimately not able to work out a solution to the removeFromArray.js challenge. I looked up the solution and copy/pasted it into my js file, but it still doesn’t pass when I run the test.

var removeFromArray = function(…args) {
const array = args[0]
return array.filter(val => !args.includes(val))
}
module.exports = removeFromArray

When I test it, there seems to be a problem with “function(…args).” Is that supposed to be in the solution verbatim, or is “…args” a place holder for something else? Thanks in advance for any replies!


#2

Hi @mjlander78

I believe the code does work, but when I copied and pasted the code into a repl to test it there was an issue with the three ... in the function arguments. I think they have not been encoded correctly. If you delete them and manually replace them with yourself then the code should work.


#3

Thank you for for the reply, sir! I will try it.


#4

I am stuck in this one as well :frowning:


#5

Hey @brugobi

What exactly are you stuck on?