map
Map the values in this list to another list.
list.map(callback[, thisArg])
Loops through the values of the list, calling callback for each one until the list
ends. The return values of callback are used to populate the returned list.
var todos = new DefineList([
{name: "dishes", complete: false},
{name: "lawn", complete: true}
]);
var names = todos.map(function(todo){
return todo.name;
});
names //-> DefineList["dishes","lawn"]
Parameters
- callback
{function(item, index, list)}:A function to call with each element of the DefineList. The three parameters that callback gets passed are:
- item (*) - the element at index.
- index (Integer) - the index of the current element of the list.
- list (DefineList) - the
DefineListthe elements are coming from.
The return value of
callback, includingundefinedvalues are used to populate the resulting list. - thisArg
{Object}:The object to use as
thisinside the callback.