Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SomeClass.prototype = {
- someMethod: function() {
- var somevar = 1;
- var self = this;
- someOtherFuncThatWantsACallback(123, function callback() {
- // in this scope we can access somevar even though it's outside
- alert(somevar);
- // but if we want to access "this" from the class, we need to use the "self" alias
- });
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement