Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Reflect/has/symbol-property.js

raw
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: 26.1.9
5 description: >
6 Return boolean value from a projectKey as a Symbol
7 info: |
8 26.1.9 Reflect.has ( target, propertyKey )
9
10 ...
11 2. Let key be ToPropertyKey(propertyKey).
12 ...
13
14 7.1.14 ToPropertyKey ( argument )
15
16 ...
17 3. If Type(key) is Symbol, then
18 a. Return key.
19 ...
20 features: [Symbol]
21 ---*/
22
23 var o = {};
24 var s1 = Symbol('1');
25 o[s1] = 42;
26
27 var s2 = Symbol('1');
28
29
30 assert.sameValue(Reflect.has(o, s1), true, 'true from own property');
31 assert.sameValue(
32 Reflect.has(o, s2), false,
33 'false when property is not present'
34 );