Skip to content

where(predicate[, arg])

suckgamoni edited this page · 2 revisions

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 iterable object that contains elements from the input sequence that satisfy the condition.


Example

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

from(fruits)
    .where("$length < 6")
    .each("console.log($)");

/*
 This code produces the following output:

 apple
 mango
 grape
*/
Something went wrong with that request. Please try again.