diff options
Diffstat (limited to 'test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-11.js')
-rw-r--r-- | test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-11.js | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-11.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-11.js index e1f08e697..e5c7a7b97 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-11.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-11.js @@ -10,28 +10,33 @@ description: > Array-like object ---*/ - var testResult = false; - function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === "9"); - } - } - - var proto = { 0: 0, 1: 1, 2: 2 }; - - var Con = function () { }; - Con.prototype = proto; - - var child = new Con(); - child.length = 3; - - Object.defineProperty(child, "0", { - get: function () { - return "9"; - }, - configurable: true - }); - - Array.prototype.reduce.call(child, callbackfn); +var testResult = false; + +function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === "9"); + } +} + +var proto = { + 0: 0, + 1: 1, + 2: 2 +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child.length = 3; + +Object.defineProperty(child, "0", { + get: function() { + return "9"; + }, + configurable: true +}); + +Array.prototype.reduce.call(child, callbackfn); assert(testResult, 'testResult !== true'); |