time-to-botec

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

repl.txt (1049B)


      1 
      2 {{alias}}( collection, fcn[, thisArg] )
      3     Invokes a function for each element in a collection and updates the
      4     collection in-place.
      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 ) { return v * i; };
     33     > var arr = [ 1.0, 2.0, 3.0 ];
     34     > var out = {{alias}}( arr, foo )
     35     [ 0.0, 2.0, 6.0 ]
     36     > var bool = ( out === arr )
     37     true
     38 
     39     See Also
     40     --------
     41