Intermediate Algorithm Scripting - Seek and Destroy

Hi, friends! Your help would be greatly appreciated!
I am somehow stuck in this challenge right now.
It keeps showing “TypeError: newArr.includes is not a function” here, but I just can’t figure out what’s wrong with that.
Thank you in advance for any advice and correction!

My code so far

function destroyer(arr) {
  let newArr = [].push(arr.slice(1));
  return arr.filter(x => !newArr.includes(x));

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Your browser information:

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

Challenge: Intermediate Algorithm Scripting - Seek and Destroy

Link to the challenge:

This says, in words, “take an empty array, push onto this empty array a slice from arr, and then assign the return value of the push operation to a variable called newArr

But… the return value of the push operation is not an array.

1 Like

Oh! Thank you so much for your prompt reply!
So, according the this site, basicly the return value would be an integer representing the count of its elememts, right?
Sorry, but could you please tell me if there is any way to compensate this as well?

Instead of focusing on ‘push’, focus on your goal. What do you want ‘newArr’ to hold?

1 Like

I intended to create an array including all the arguments here (i.e. except the first element which is a given subarray), then to use the “filter” plus “includes” function to meet the requirement in this challenge.

Hmm, but arr is only the first argument. You should look up the “arguments object”.

1 Like

Gotcha! Really helpful to me!
This is so nice of you! I sincerely applaud! :blue_heart:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.