The variable is captured in the context of the object. I think it’s easier to see here:
For further reading (super interesting stuff), look up closures.