diff options
Diffstat (limited to 'test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-31.js')
-rw-r--r-- | test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-31.js | 66 |
1 files changed, 31 insertions, 35 deletions
diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-31.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-31.js index db862cce1..f948d2978 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-31.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-31.js @@ -9,40 +9,36 @@ description: > iterations is observed on an Array-like object ---*/ -var testResult = false; -var initialValue = 0; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} - -var obj = { - 2: 2, - length: 3 -}; -var preIterVisible = false; - -Object.defineProperty(obj, "0", { - get: function() { - preIterVisible = true; - return 0; - }, - configurable: true -}); - -Object.defineProperty(obj, "1", { - get: function() { - if (preIterVisible) { - return 1; - } else { - return "11"; - } - }, - configurable: true -}); - -Array.prototype.reduce.call(obj, callbackfn, initialValue); + var testResult = false; + var initialValue = 0; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } + + var obj = { 2: 2, length: 3 }; + var preIterVisible = false; + + Object.defineProperty(obj, "0", { + get: function () { + preIterVisible = true; + return 0; + }, + configurable: true + }); + + Object.defineProperty(obj, "1", { + get: function () { + if (preIterVisible) { + return 1; + } else { + return "11"; + } + }, + configurable: true + }); + + Array.prototype.reduce.call(obj, callbackfn, initialValue); assert(testResult, 'testResult !== true'); |