22 lines
259 B
CoffeeScript
22 lines
259 B
CoffeeScript
![]() |
x: 1
|
||
|
y: {}
|
||
|
y.x: => 3
|
||
|
|
||
|
print(x is 1)
|
||
|
print(typeof(y.x) is 'function')
|
||
|
print(y.x() is 3)
|
||
|
print(y.x.name is 'x')
|
||
|
|
||
|
|
||
|
obj: {
|
||
|
name: "Fred"
|
||
|
|
||
|
bound: =>
|
||
|
(==> print(this.name is "Fred"))()
|
||
|
|
||
|
unbound: =>
|
||
|
(=> print(!this.name?))()
|
||
|
}
|
||
|
|
||
|
obj.unbound()
|
||
|
obj.bound()
|