4 ms·
This [0] is the only difference I am aware of. But I would love to hear someone talk about performance differences (if any). [0]: http://stackoverflow.com/a/33
by prezjordan 14y ago
This [0] is the only difference I am aware of. But I would love to hear someone talk about performance differences (if any).
[0]: http://stackoverflow.com/a/336868/712889 http://stackoverflow.com/a/336868/712889
- mattmanser 14y agoI actually got in an argument with someone on SO the other day who swore blind that the only was to declare a 'class' was using this pattern. Took a fiddle to shut him up. I just don't get what it adds to your code apart from hiding simple function definitions in the visual trappings of a static helper object or closure. Javascript is already homogeneous enough without making it visually even more.
- jonahx 14y ago>> I just don't get what it adds to your code apart from hiding simple function definitions in the visual trappings of a static helper object or closure. Javascript is already homogeneous enough without making it visually even more. What method do you use instead of the following, when creating namespaces? var yourNamespace = { foo: function() { }, bar: function() { } };
- piva00 14y agoWait, I don't think that JavaScript is homogeneous, not in the least, for me it's really heterogeneous, I can look at 3 or 4 scripts developed by people of different skills and backgrounds and see it done in 3 or 4 completely different styles, visually and syntactically. Did you messed up the wording over homogeneity?
- mattmanser 14y agoI mean the syntax is homogeneous, I agree the styles in use today certainly aren't!
- jonahx 14y agoThe one I mentioned above, you cannot conditionally create functions using function declarations.