Array builtins are currently inconsistent with ES5 builtins in the way they handle this. There are two differences:
If thisArg is omitted, the callback is called with this set to undefined in ES5 (forEach, map, ...) but to the array itself in streamline's builtins (forEach_, map_, ...).
reduce_ and reduceRight_ take a thisArg parameter; reduce and reduceRight don't!
Array builtins are currently inconsistent with ES5 builtins in the way they handle
this
. There are two differences:thisArg
is omitted, the callback is called withthis
set toundefined
in ES5 (forEach
,map
, ...) but to the array itself in streamline's builtins (forEach_
,map_
, ...).reduce_
andreduceRight_
take athisArg
parameter;reduce
andreduceRight
don't!See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Parameters and related pages.
I propose to fix this and align streamline's builtins on the ES5 array builtins.