getter.js (554B)
1 // Copyright (C) 2014 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 12.2.5 5 description: > 6 Computed property names for getters 7 ---*/ 8 var s = Symbol(); 9 var A = { 10 get ["a"]() { 11 return "A"; 12 }, 13 get [1]() { 14 return 1; 15 }, 16 get [s]() { 17 return s; 18 } 19 }; 20 assert.sameValue(A.a, "A", "The value of `A.a` is `'A'`"); 21 assert.sameValue(A[1], 1, "The value of `A[1]` is `1`"); 22 assert.sameValue(A[s], s, "The value of `A[s]` is `Symbol()`"); 23 24 reportCompare(0, 0);