Debian Codegraph @

js/src/tests/test262/language/statements/for-of/array.js

raw
1 // Copyright (C) 2013 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: >
6 Array instances should be able to be traversed using a `for...of` loop.
7 es6id: 13.6.4
8 ---*/
9
10 var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
11 var i = 0;
12
13 for (var value of array) {
14 assert.sameValue(value, array[i], 'element at index ' + i);
15 i++;
16 }
17
18 assert.sameValue(i, 8, 'Visits all elements');
19
20 reportCompare(0, 0);