Code is working but can't pass the test

Hello campers, I’m having a little challenge here. I can’t figure out why my code works perfectly but is unable to pass the test. Please can someone help me out.

From JavaScript Algorithms and data structure. Intermediate algorithms scripting. Diff Two Arrays.

You are not returning anything from the function.

Ok pardon me I’m just a beginner but i thought the last return statement takes care of it ? Or are you refaring to the two callback functions ?

You’re returning the result of console.log(newArr) which is undefined.

1 Like

To get the same effect, you could console.log on the line before and just return the value.

And inthe future, please don’t post pictures of code. Cut and paste the code and provide a link to the challenge.

Or just console.log the final result with your test code: console.log(diffArray([1... In some ways that’s a better way to log anyway because you are sure you are logging what the function returns.

Ok I got it thanks a lot

Thanks for your input sir. And regarding the picture, that is the only option i have for now because just like i complaint yesterday, i can’t access this forum using my PC and i figured i need to change my OS if i must rectify that. So please pardon me for now.

Please don’t take pictures of the code. Just don’t. It is really hard to read that picture and taking a picture makes it impossible for us to run your code.