summaryrefslogtreecommitdiff
path: root/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js')
-rw-r--r--test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js38
1 files changed, 19 insertions, 19 deletions
diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js
index 8d3811a03..ccb63b811 100644
--- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js
+++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js
@@ -9,27 +9,27 @@ description: >
iteration and not prior to starting the loop on an Array
---*/
- var arr = [11, 12, 13, 14];
- var kIndex = [];
- var result = true;
- var called = 0;
+var arr = [11, 12, 13, 14];
+var kIndex = [];
+var result = true;
+var called = 0;
- //By below way, we could verify that k would be setted as 0, 1, ..., length - 1 in order, and each value will be setted one time.
- function callbackfn(preVal, curVal, idx, o) {
- //Each position should be visited one time, which means k is accessed one time during iterations.
- called++;
- if (typeof kIndex[idx] === "undefined") {
- //when current position is visited, its next index should has been visited.
- if (idx !== arr.length - 1 && typeof kIndex[idx + 1] === "undefined") {
- result = false;
- }
- kIndex[idx] = 1;
- } else {
- result = false;
- }
- }
+//By below way, we could verify that k would be setted as 0, 1, ..., length - 1 in order, and each value will be setted one time.
+function callbackfn(preVal, curVal, idx, o) {
+ //Each position should be visited one time, which means k is accessed one time during iterations.
+ called++;
+ if (typeof kIndex[idx] === "undefined") {
+ //when current position is visited, its next index should has been visited.
+ if (idx !== arr.length - 1 && typeof kIndex[idx + 1] === "undefined") {
+ result = false;
+ }
+ kIndex[idx] = 1;
+ } else {
+ result = false;
+ }
+}
- arr.reduceRight(callbackfn, 1);
+arr.reduceRight(callbackfn, 1);
assert(result, 'result !== true');
assert.sameValue(called, 4, 'called');