where(predicate[, arg])

Filters a sequence of values based on a predicate.

Syntax

Parameters

predicate
A function to test each element for a condition.
arg
An external argument.
Return Value

An iteratable object that contains elements from the input sequence that satisfy the condition.

Examples

var fruits = [ "apple", "passionfruit", "banana", "mango", "orange", "blueberry", "grape", "strawberry" ];

var query = $from(fruits).where("$length < 6");
query.each("document.writeln($)");

/*
 This code produces the following output:

 apple
 mango
 grape
*/

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

Comments

No comments yet.