count()

The count linq operator returns a count of the number elements in the collection.
var arr = [1, 2, 3, 4, 5];

// num = 5
var num = $linq(arr).count();
The count operator can also take a predicate function--where a count of the number of elements in the collection that satisfy the predicate is returned.
var arr = [1, 2, 3, 4, 5];

// num = 3
var num = $linq(arr).count("x => x < 4");

Last edited Sep 7, 2012 at 5:54 AM by battousai999, version 6