var list1 = [
{ a: 1, b: 4, c: 1, d: 'z' },
{ a: 0, b: 1, c: 2, e: 5 },
{ a: 1, b: 3, c: 3, d: 'y' },
{ a: 0, b: 2, c: 4, d: 'x' }
];
Example 1: Range comprehension
return even numbers between 0 and 10
Example 2: Passing an array
return even numbers from the array of numbers
Example 3: Get the first result.
return the first from list1 where a = 1 and b = 3, ordered by b:
Example 4: Passing parameters
return numbers between 0 and 10 are divisible by the p1 parameter (3 in this case):
Example 5: Return selected properties, sorted
return properties { a, b } from list1, ordered by b:
Example 6: Return single property
return property c from items in list1 where a = 1, ordered by b:
Example 7: Selecting by function
return property b from list1:
Example 8: Filtering by function
return property b from list1:
Example 9: Specifying the interval of a range comprehension
return numbers between 0 and 6, incrementing by 2 (0, 2, 4, 6):