skipWhile(predicate[, arg])

suckgamoni edited this page May 15, 2013 · 1 revision

Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.

Syntax

Parameters

predicate

Type: function(value, key, arg): boolean
A function to test each element for a condition.

arg

An external argument.

Return Value

An iterable object that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.


Example

var grades = [ 59, 82, 70, 56, 92, 98, 85 ];

var lowerGrades = from(grades)
    .orderByDesc()
    .skipWhile("$ >= 80");

console.log("All grades below 80:");
lowerGrades.each("console.log($)");

/*
 This code produces the following output:

 All grades below 80:
 70
 59
 56
*/