-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile1.js
62 lines (48 loc) · 1021 Bytes
/
file1.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
// // binary2decimal conversion class
// class conversion {
// b2d(b) {
// return parseInt(b, 2).toString(10);
// }
// d2b(d) {
// return parseInt(d, 10).toString(2);
// }
// }
// const convert = new conversion();
// const result = {
// a: 1,
// b: 2,
// add: function (c, d) {
// document.write(this.a + this.b);
// },
// };
// const data1 = {
// a: 5,
// b: 5,
// sub: function (c, d) {
// return this.a + this.b + c + d;
// },
// };
// const data2 = {
// a: 15,
// b: 25,
// };
// // call
// // console.log(result.add(1, 2));
// // console.log(typeof result.add.call(data1, 1, 2));
// // console.log(result.add.apply(data1, [1, 2]));
// setTimeout(
// () => {
// result.add.call(data1);
// },
// // console.log(result.add.bind(data1)(1,2));
// 6000
// );
// // console.log(result.add.call(data2));
// // apply
// // console.log(data2..apply());
// const b = 2;
// (function () {
// console.log(c);
// var c = 2;
// })();
// call , apply , bind