ChakraCore icon indicating copy to clipboard operation
ChakraCore copied to clipboard

Changing array to es5array on array method does not give correct output.

Open akroshg opened this issue 10 years ago • 2 comments

(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.

akroshg avatar Nov 01 '16 18:11 akroshg

@bterlson to comment on that.

akroshg avatar Nov 01 '16 18:11 akroshg

@akroshg what comment do you want? I agree that our behavior is incorrect here.

bterlson avatar Nov 01 '16 19:11 bterlson