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
|
<!
DOCTYPE
html>
<
html
>
<
head
>
<
title
>ExtJs</
title
>
<
meta
http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<
link
rel="stylesheet" type="text/css" href="ExtJs/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css">
<
script
type="text/javascript" src="ExtJs/ext-all.js"></
script
>
<
script
type="text/javascript" src="ExtJs/bootstrap.js"></
script
>
<
script
type="text/javascript" src="ExtJs/packages/ext-theme-crisp/build/ext-theme-crisp.js"></
script
>
</
head
>
<
body
>
<
script
type="text/javascript">
function Person(){
this.name = 'hanzichi';
this.age = 10;
}
var num = 0;
for (var i in Person.prototype)
num++;
console.log(num);
Person.prototype.show = function(){
console.log(this.name);
};
Person.prototype.sex = 'male';
var a = new Person();
console.log(a.sex);
a.show();
console.log(a.__proto__ === Person.prototype);
console.log(a.constructor === Person);
console.log(Person.prototype.constructor === Person);
console.log(Person.prototype);
console.log(a);
console.log('string'.constructor);
console.log(new String('string').constructor);
console.log(/hello/.constructor);
console.log([1,2,3].constructor);
function A() {}
var a = new A()
console.log(a.constructor);
function Book(name){
this.name = name;
};
Book.prototype.getName = function(){
return this.name;
};
Book.prototype = {
//constructor: Book,
getPName: function(){
return this.name;
}
};
Book.prototype.constructor = Book;
var b = new Book("ON THE WAY");
console.log(b.constructor === Book);
console.log(Book.prototype.constructor === Book);
console.log(b.constructor.prototype.constructor == Book);
</
script
>
<
body
>
<
div
id="tpl-table">
<
div
>员工信息</
div
>
</
div
>
</
body
>
</
html
>
|