Re:JavaScript Programming Patterns
by thegrossman on Tuesday October 06, 2009 @10:42AM
(#864220)
That works, too!
The reason I like using _obj is because "this" is notoriously hard to work with in JS. If, inside foo(), you have an iterator that you pass a function to, "this" takes on a different meaning inside that function.
Some people are really good at working out what "this" refers to, but I'm not. So I assign the main object to _obj just to be safe.
The reason I like using _obj is because "this" is notoriously hard to work with in JS. If, inside foo(), you have an iterator that you pass a function to, "this" takes on a different meaning inside that function.
Some people are really good at working out what "this" refers to, but I'm not. So I assign the main object to _obj just to be safe.