Question on Arguments object in Drop it

Tell us what’s happening:

Hello, I’m still coming up with a plan for addressing this challenge and just trying to write up my basic approach. I looked at the hint and saw that three approaches were suggested. slice() and shift() I understand because shift would be used to remove the first element and the condition for that could be func !== true and slice() and can’t explain so well, but I can speculate that it could be used to create a new arr without any of the elements which do not meet the condition of func and return that as arr (understanding probably a bit flawed there…)
However, I don’t understand how arguments object could be of ANY use. Isn’t arguments object for revealing elements that are not visible and don’t you have all elements available? Why do you need to use arguments? It seems like, at best, ornament and nothing more. Slice and shift seem the most useful and functional.

Where am I wrong in my understanding?

Your code so far


//
function dropElements(arr, func) {

while(func !== true){
 arr.shift();
} 
console.log(arr)
  return arr;
}

dropElements([1, 2, 3, 4], function(n) {return n > 5; });

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it/

I think I can understand what you’re getting at. I’m not entirely sure what you would need the arguments object for in this exercise either. I completed it without the need to access the arguments object. From my understanding, it only seems to make sense to access the arguments object in case a function receives more arguments than there are parameters, but that doesn’t happen with any of these test cases. I would say that if you don’t need it, then don’t worry about it. Let me know if this helps.

func is a function, so when you compare it to the value true, it is not going to be equal, so your while loop creates an infinite loop.

Thanks both of you guys. This nudged me in the correct direction.