-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode
More file actions
34 lines (30 loc) · 833 Bytes
/
code
File metadata and controls
34 lines (30 loc) · 833 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
34
1
var jdb = (function () {
var Jdb = function (str) {
};
Jdb.prototype.alert = function (str) {
alert(str);
return this;
};
Jdb.prototype.console = function (str) {
console.log(str);
return this;
};
return new Jdb();
})()
调用直接 jdb.alert('调用alert')
2
var jdb = (function () {
var Jdb = function (str) {
};
Jdb.prototype.alert = function (str) {
alert(str);
return this;
};
Jdb.prototype.console = function (str) {
console.log(str);
return this;
};
return Jdb;
})()
调用的时候需要先进行实例化 new jdb().alert('调用alert')