-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathconstructor1.js
69 lines (54 loc) · 2.93 KB
/
constructor1.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
function write(v) { WScript.Echo(v + ""); }
var o;
o = Object();
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = new Object();
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = Object(null);
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o2 = new Object(null);
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = Object(undefined);
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = new Object(undefined);
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = Object(true);
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = new Object(true);
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = Object(new Boolean(false));
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = new Object(new Boolean(false));
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = Object(0);
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = new Object(0);
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = Object(new Number(10));
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = new Object(new Number(10));
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = Object("hello");
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = new Object("hello");
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = Object(new String("hello"));
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
o = new Object(new String("hello"));
write("o:" + o + " typeof(o):" + typeof(o) + " o.toString():" + Object.prototype.toString.call(o));
var b = new Boolean(true);
b.x = 10;
o = new Object(b);
write("o.x = " + o.x);
var n = new Number(100);
n.x = 20;
o = new Object(n);
write("o.x = " + o.x);
var s = new String("world");
s.x = 30;
o = new Object(s);
write("o.x = " + o.x);