diff options
Diffstat (limited to 'test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-3.js')
-rw-r--r-- | test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-3.js | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-3.js b/test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-3.js index 19a4e19a0..0a23d5c01 100644 --- a/test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-3.js +++ b/test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-3.js @@ -10,23 +10,29 @@ description: > Array-like object ---*/ - var testResult = false; - var initialValue = 0; - function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === "11"); - } - } +var testResult = false; +var initialValue = 0; - var proto = { 0: 0, 1: 1, 2: 2, length: 2 }; - var Con = function () { }; - Con.prototype = proto; +function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === "11"); + } +} - var child = new Con(); - child[1] = "11"; - child[2] = "22"; - child.length = 3; +var proto = { + 0: 0, + 1: 1, + 2: 2, + length: 2 +}; +var Con = function() {}; +Con.prototype = proto; - Array.prototype.reduce.call(child, callbackfn, initialValue); +var child = new Con(); +child[1] = "11"; +child[2] = "22"; +child.length = 3; + +Array.prototype.reduce.call(child, callbackfn, initialValue); assert(testResult, 'testResult !== true'); |