6 ms·
sorry, but why would carry the extra _obj around? why not simple do it like in my example above?
by monos 17y ago
sorry, but why would carry the extra _obj around? why not simple do it like in my example above?
- thegrossman 17y agoThat 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.