-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathh-own.js
More file actions
33 lines (28 loc) · 750 Bytes
/
h-own.js
File metadata and controls
33 lines (28 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
const cSymbol = Symbol('c');
const object = {
a: 1,
[cSymbol]: 2,
[Symbol('d')]: 3,
};
console.table({
a: object.hasOwnProperty('a'),
b: object.hasOwnProperty('b'),
cSymbol: object.hasOwnProperty(cSymbol),
'Symbol(\'d\')': object.hasOwnProperty(Symbol('d')),
toString: object.hasOwnProperty('toString'),
});
console.log();
const array = [1, 2, 3];
array[cSymbol] = 4;
array.key = 5;
console.table({
0: array.hasOwnProperty(0),
1: array.hasOwnProperty(1),
10: array.hasOwnProperty(10),
cSymbol: array.hasOwnProperty(cSymbol),
'Symbol(\'d\')': array.hasOwnProperty(Symbol('d')),
toString: array.hasOwnProperty('toString'),
map: array.hasOwnProperty('map'),
length: array.hasOwnProperty('length'),
});