map-iterable.js (643B)
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 esid: sec-map-iterable 5 description: > 6 Contructor returns a map object set with the elements from the iterable 7 argument. 8 info: | 9 Map ( [ iterable ] ) 10 11 ... 12 9. Repeat 13 a. Let next be IteratorStep(iter). 14 b. ReturnIfAbrupt(next). 15 c. If next is false, return map. 16 ... 17 ---*/ 18 19 var m = new Map([ 20 ["attr", 1], 21 ["foo", 2] 22 ]); 23 24 assert.sameValue(m.size, 2, 'The value of `m.size` is `2`'); 25 assert.sameValue(m.get("attr"), 1); 26 assert.sameValue(m.get("foo"), 2); 27 28 reportCompare(0, 0);