Drop While

Remove elements from the start of an array while a condition is true.

Code

General
const idx = arr.findIndex(x => x >= threshold);
return idx === -1 ? [] : arr.slice(idx);

Parameters

Array

Drop while less than threshold

Browser·fetch() may be limited by CORS

More JavaScript Snippets