function example(arr, func) {
func(arr[2]); //true
return arr.find(func); //returns 3 as the first index of the array that passes the test
}
example([1, 2, 3, 4], function(n) {return n >= 3;}); // 3
How come return arr.find(func);
returns 3 as the first index that passes the test when func(arr[2]);
returns true and therefore arr[2] should be the first index that returns true for the given test function.