Seek and Destory makes zero sense

seek and destroy is a part of the basic algorithm scripting section for the front end development certification

this makes absolutely no sense. being stuck on this for i think over a month now, I even had to give up and cheat by reading the spoiler, and it STILL makes no sense to me, because i STILL can’t get this right. why won’t something like “arr[0][1]” work in this? i’ve been trying to self-teach programming in many languages for almost a decade now, but this is so infuriating that it makes me want to quit programming altogether, which in the past month i’ve been stuck on this, i basically already have. not even my friends who are actually going to a university for computer science can understand this.

We’d be happy to help you understand this challenge long before you’ve been beating your head against it for a month. Often there’s just one wire that needs to be uncrossed for you to be on a roll again. What part don’t you understand? The requirements? The expected results?

The best way to get useful help is to share your code and explain what you expect it to be doing and what it is actually doing. The more you can tell us about the different things you’ve tried and why, the better we can help you.

function destroyer(arr) {
  // Remove all the values
  for (x = 0; x < arr[0].length; x++) {
    if (arr[0][x] == arr[1]) {
  return arr;

this isn’t perfect, but it’s the ballpark idea of what i think should theoretically work for this, based on all i’ve been taught about programming, and mathematical logic in general over the years.

I can’t tell whether you are using the beta or not, so I will refrain from using the Beta FCC’s recommendation of ES6 Javascript shortcuts.

There’s a different set of advice I would recommend based on what you’re using, but until we hear back from you, like the production site, I highly recommend you read this documentation on the arguments object for Javascript functions.
It might clear up some syntactic issues for you (the dimensionality of the argument arr) for example. If you want a fairly parallel example of what mistake you’re making re: dealing with an arbitrary number of arguments, there’s a good answer on Stackoverflow here.

A couple things:
.pop() removes the last element of an array. arr[0][x].pop() would remove the last item from arr[0][x] is an array. I don’t think that’s what you mean to do.
I suspect that you are trying to remove arr[0][x] from arr[0]. This introduces a very common logical error that almost all new programming students make at least once: you do not want to modify an array that you are iterating over. Adding or removing items in arrays changes the indexing, which can result in incorrect results or infinite loops that crash your browser.

1 Like