Seek and Destroy


I got this to work using .filter(). Just wondering why using .map() returns boolean values.


function destroyer(arr) {
  for (let i = 1; i < arguments.length; i++) {
    arr = => num !== arguments[i]);
    return arr;
destroyer([1, 2, 3, 1, 2, 3], 2, 3);     

Because this expression gets evaluated as either true or false. map creates a new array of elements using the return value of the callback function supplied. In this case, it is just a Boolean.

1 Like

Got it. Thanks for answering!

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