Returns an updated collection element.
Returns an updated collection element.
Returns an updated collection element.
Returns an updated collection element.
Invokes a function once for each element in a collection and updates the collection in-place, iterating from right to left.
inmap
(iterating from left to right) is when elements are pushed onto the beginning (end) of an array. In other words, for inmap()
, [].push()
behavior is consistent with inmapRight()
[].unshift()
behavior.input collection
function to invoke
execution context
input collection
function scale( value, index, collection ) {
console.log( '%s: %d', index, value );
return value * index;
}
var arr = [ 1, 2, 3, 4 ];
var out = inmapRight( arr, scale );
// returns [ 0, 2, 6, 12 ]
var bool = ( out === arr );
// returns true
Returns an updated collection element.
collection value
collection index
updated element