uint16array.js (672B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 13.6.4 5 description: Uint16Array traversal using for..of 6 info: | 7 Uint16Array instances should be able to be traversed using a `for..of` 8 loop. 9 features: [TypedArray] 10 ---*/ 11 12 var iterationCount = 0; 13 var array = new Uint16Array([3, 2, 4, 1]); 14 15 var first = 3; 16 var second = 2; 17 var third = 4; 18 var fourth = 1; 19 20 for (var x of array) { 21 assert.sameValue(x, first); 22 23 first = second; 24 second = third; 25 third = fourth; 26 fourth = null; 27 28 iterationCount += 1; 29 } 30 31 assert.sameValue(iterationCount, 4); 32 33 reportCompare(0, 0);