12 lines
215 B
JavaScript
12 lines
215 B
JavaScript
function dropElements(arr, func) {
|
|
if (arr.findIndex(func) === -1) {
|
|
return [];
|
|
}
|
|
return arr.slice(arr.findIndex(func));
|
|
}
|
|
|
|
console.log(
|
|
dropElements([1, 2, 3], function (n) {
|
|
return n >= 5;
|
|
})
|
|
);
|