Finders Keepers - is it this easy?

I having second thoughts about whether this is good or not, because I wrote this code in under one minute and it passes the whole challenge. Is there any hidden catch to this challenge? :slight_smile:

function findElement(arr, func) {
  var num = 0;
  var filtered = arr.filter(func);
  return filtered[0];
}

Thanks @P1xt!
As short as any of my solutions seem to be, you are bound to have a shorter one. You are an amazing coder :slight_smile:

oh man, this one might be a jog :smile:

function findersKeepers(arr, fun) {
  return arr.find(fun);
}
2 Likes