skipWhile(predicate[, arg])

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 iteratable 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.

Examples

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

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

document.writeln("All grades below 80:");
lowerGrades.each("document.writeln($)");

/*
 This code produces the following output:

 All grades below 80:
 70
 59
 56
*/

Last edited May 18, 2012 at 10:30 AM by suckgamoni, version 1

Comments

No comments yet.