ChakraCore
ChakraCore copied to clipboard
Changing array to es5array on array method does not give correct output.
(function() {
var arr = [11, 22, 33, 44];
var first = true;
arr.reduce(function (a1, a2, a3, a4) {
if (first) {
first = false;
Object.defineProperty(arr, '2', { get : function() {
return 201;
}});
}
console.log(a2);
});
})();
This should print (Chrome and Firefox do that) 22 201 44
Actual 22 44
This is because we use the DirectGetItem to fetch values.
@bterlson to comment on that.
@akroshg what comment do you want? I agree that our behavior is incorrect here.