-
Notifications
You must be signed in to change notification settings - Fork 8
/
test.js
65 lines (51 loc) · 1.26 KB
/
test.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
// document.getElementById("button1").addEventListener("click", click1, {
// })
// function click1(event) {
// console.log(event.offsetX);
// console.log(event.clientX);
// console.log(event.pageX);
// console.log(event.screenX);
// console.log(this);
// click2.call(this);
// }
// function click2() {
// console.log("click2");
// console.log(this);
// }
// document.getElementById("parentDiv").addEventListener(
// "click", (event) => {
// console.log("click parentDiv");
// event.stopPropagation()
// }
// , false
// )
// let promise2 = Promise.resolve('ddd').then(1);
// promise2.then(console.log);
const test = {
testf() {
console.log(
this
);
},
testfun2: function () {
console.log(
this
);
}
};
// const fun1 = test.testf;
// new fun1()
const testfun2 = test.testfun2;
new testfun2()
// console.log('fun1 ' + fun1());
const test2 = function () {
this.key2 = 'dd';
}
test2.prototype = {
key1: 11
}
const testCreate = {}
Object.setPrototypeOf(testCreate, test2.prototype);
console.log(testCreate);
const test2Obj = new test2();
console.log(JSON.stringify(test2Obj));