Gigya Job Openings

Collection JS

Skip to end of metadata
Go to start of metadata



This object represents a collection of other Gigya objects. It has member functions that perform operations on the entire collection or return individual items from it.

Member Methods

Method Name
Return ValueDescription
asArray()ArrayReturns the collection as an array of the contained objects.
each(function(item, index))None

This function accepts a function reference as a parameter and calls that function on each item in the collection. The called function receives one item from the collection and the index of the item (zero based) as parameters.
For example, the following code will print each item in the collection col:

function print(item, index) {
    document.write("index="+index+" item="+item);
getById(itemID)objectReturns an item from the collection by its ID.
getSize()numberReturns the number of items in the collection.