diff options
Diffstat (limited to 'test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-30.js')
-rw-r--r-- | test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-30.js | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-30.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-30.js index c307ddda9..45f396f05 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-30.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-30.js @@ -9,35 +9,36 @@ description: > iterations is observed in subsequent iterations on an Array ---*/ - var testResult = false; - function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } - } - - var arr = [, , 2]; - var preIterVisible = false; - - Object.defineProperty(arr, "0", { - get: function () { - preIterVisible = true; - return 0; - }, - configurable: true - }); - - Object.defineProperty(arr, "1", { - get: function () { - if (preIterVisible) { - return 1; - } else { - return 100; - } - }, - configurable: true - }); - - arr.reduce(callbackfn); +var testResult = false; + +function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } +} + +var arr = [, , 2]; +var preIterVisible = false; + +Object.defineProperty(arr, "0", { + get: function() { + preIterVisible = true; + return 0; + }, + configurable: true +}); + +Object.defineProperty(arr, "1", { + get: function() { + if (preIterVisible) { + return 1; + } else { + return 100; + } + }, + configurable: true +}); + +arr.reduce(callbackfn); assert(testResult, 'testResult !== true'); |