time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1143B)


      1 
      2 {{alias}}( collection, fcn[, thisArg] )
      3     Invokes a function for each element in a collection and updates the
      4     collection in-place, iterating from right to left.
      5 
      6     When invoked, the input function is provided three arguments:
      7 
      8     - `value`: collection value
      9     - `index`: collection index
     10     - `collection`: the input collection
     11 
     12     Parameters
     13     ----------
     14     collection: Array|TypedArray|Object
     15         Input collection. If provided an object, the object must be array-like
     16         (excluding strings and functions).
     17 
     18     fcn: Function
     19         Function to invoke for each element in the input collection. The
     20         function's return value is used to update the collection in-place.
     21 
     22     thisArg: any (optional)
     23         Execution context.
     24 
     25     Returns
     26     -------
     27     out: Array|TypedArray|Object
     28         Input collection.
     29 
     30     Examples
     31     --------
     32     > function foo( v, i ) { console.log( '%s: %d', i, v ); return v * i; };
     33     > var arr = [ 1.0, 2.0, 3.0 ];
     34     > var out = {{alias}}( arr, foo )
     35     2: 3.0
     36     1: 2.0
     37     0: 1.0
     38     [ 0.0, 2.0, 6.0 ]
     39     > var bool = ( out === arr )
     40     true
     41 
     42     See Also
     43     --------
     44