blob: 0cf84155ccc53044a781df792de3d500da57ef8a (
plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
function exists() {
var a = {'null': 1, 'undefined': 2};
for (var i = 0; i < 100; i++) {
assertEq(a[null], 1);
assertEq(a[undefined], 2);
}
}
function missing() {
var a = {};
for (var i = 0; i < 100; i++) {
assertEq(a[null], undefined);
assertEq(a[undefined], undefined);
}
}
function getter() {
var a = {
get null() {
return 1;
},
get undefined() {
return 2;
}
}
for (var i = 0; i < 100; i++) {
assertEq(a[null], 1);
assertEq(a[undefined], 2);
}
}
function primitive() {
var v = true;
for (var i = 0; i < 100; i++) {
assertEq(v[null], undefined);
assertEq(v[undefined], undefined);
}
}
function mixed() {
var a = {'null': 'null', 'undefined': 'undefined'};
for (var i = 0; i < 100; i++) {
var v = a[i % 2 ? null : undefined]
assertEq(a[v], i % 2 ? 'null' : 'undefined');
}
}
exists();
missing()
getter();
primitive();
mixed();
|