Drop it - need some lead in this

Drop it - need some lead in this
0.0 0

#1

Tell us what’s happening:
This thing does work in a strach pad app on my mobile, but it fails the test here. I know, recrusive function, but do I miss something or just bumped into a bug?

Your code so far

function dropElements(arr, func) {
  // Drop them elements.

if (arr.length == 0) {
  	return arr;
  } else if (func(arr[0])) {
  	return arr;
  } else {
  	arr.shift();
  	dropElements(arr, func);
  }

}

dropElements([1, 2, 3], function(n) {return n < 3; });

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Android 8.1.0; Mobile; rv:61.0) Gecko/61.0 Firefox/61.0.

Link to the challenge:


#2

You are just missing a return before dropElements(arr, func); on line 10 :smiley:


#3

THANX, it is time to go to bed. The app on my phone has a console only. :rofl::rofl: