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
|
function foo () { console.log(this.a); } var a = 0 let obj = { a: 1, foo }
var bar = obj.foo bar()
var b = 11 function foo1 () { console.log(this.b); } function bar1 (fn) { fn() } var obj1 = { b: 12, foo1:foo1 }
bar1(obj1.foo1)
var c = 22 function foo3 () { console.log(this.c); } var obj3 = { c: 33, foo3: foo3 } setTimeout(obj3.foo3, 1000)
function foo4 () { console.log(this.dd); } var dd = 33 var obj4 = { dd: 44, foo4: foo4 } var p = {dd: 55} obj4.foo4()
!(p.foo5 = obj4.foo4)()
p.foo6 = obj4.foo4 p.foo6()
var ee = 88 var obj5 = { ee: 77, foo8: foo8 } function foo8 () { console.log(this.ee); } !(obj5.foo8 = obj5.foo8)() !(false || obj5.foo8)() !(1, obj5.foo8)()
|