Skip to content

Drop it challenge does not pass? #7677

Closed
NaitoKenzo opened this Issue · 0 comments

1 participant

@NaitoKenzo

Issue Description

I tested the following code for drop it in the console and it seems to work but it won't pass.

Browser Information

  • Chrome, 49.0.2623.87
  • Mac OS

My Code

function drop(arr, func) {
  // Drop them elements.
  if (arr.length) {
    if (func(arr[0])) {
      console.log(arr);
      return arr;
    } else {
      arr.shift();
      drop(arr, func);
    }
  } else {
    return [];
  }
}

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

Screenshot

capture d ecran 2016-03-21 a 16 42 03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.