3 ms·
Neither would be any good, really for better coding. namespace.functionName = function() { } I'm not talking about performance here, but from a sheer maintain
by gopalv 12y ago
Neither would be any good, really for better coding.
namespace.functionName = function() { }
I'm not talking about performance here, but from a sheer maintainability nightmare that JS creates. If you care about this, don't let your functions be unbound.
The only reason to store a function in a var is because it is a closure.
And in a way, a closure is data encapsulation in a totally non OO way.
- Terr_ 12y ago> namespace.functionName = function() { } I'd rather use Asychronous Module Definitions: http://requirejs.org/docs/whyamd.html http://requirejs.org/docs/whyamd.html
- untog 12y agoIMO there's nothing wrong with declaring functions with a var. It's part and parcel of functions being a first class object in JS, and you being able to pass it around in functions.