-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjs_basics_function.html
More file actions
135 lines (86 loc) · 1.63 KB
/
Copy pathjs_basics_function.html
File metadata and controls
135 lines (86 loc) · 1.63 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<script>
var Cmbd1 = {
name:'Abd1'
}
var Cmfi1 = {
name:'Afi1'
}
function Cmbd(){
//this.name = 'Abd';
}
function Cmfi(){
this.name = 'Afi';
}
var aDev = new Cmbd();
var aDev1 = {name:'aDev1'};
//console.log(aDev1.name);
//aDev1.__proto__ = Cmbd1;
var aDev1 = Object.create(Cmbd1);
console.log(aDev1.name);
console.log(aDev1.__proto__ == aDev1.prototype);
aDev1.__proto__ = Cmfi1;
console.log(Cmfi1.isPrototypeOf(aDev1));
//console.log(aDev.__proto__ == aDev.prototype);
//aDev1.__proto__ = Cmbd1;
//console.log(aDev.__proto__ == aDev.prototype);
//console.log(aDev1.__proto__ == aDev1.prototype);
/**/
var aDevBd = new Cmbd();
//console.log(aDevBd);
//aDevBd.__proto__ = new Cmfi;
console.log(aDevBd.__proto__);
aDevBd.__proto__ = new Cmfi;
console.log( aDevBd.name );
console.log(Cmfi.isPrototypeOf(aDevBd));
console.log(aDevBd.constructor);
/*
'use strict'
function a(){
var x = 'Hi';
return function b(){
console.log(x);
}
//return b;
}
//console.log( a());
a()();
//x();
*/
/*
function afnc(){
}
var aFunc = function (){
}
var anoFunc = new Function('a','return a');
//scope
var y = 0;
y1 = 0;
function a(){
var x = 0;
x1 = 0;
}
var name = 'Win';
function A(){
this.name = 'A';
}
var anObj = new A();
console.log(this);//window
function sayHello(){
console.log('Hi '+ this.name +" "+ arguments[0]);
}
window.sayHello();
anObj.sayHi = sayHello;
//anObj.sayHi();
sayHello.call(anObj,'xyz');
sayHello.apply(anObj,['xyz']);//apply will work similarly but arguments should be passed as an array
*/
/*
this = {}
return this
return xyz
*/
function a(){
return this;
}
console.log(new a());
</script>