This one can be useful, but it's misnamed as they're not local.
Assertion
A better title would have been "how to make your own exceptions", which is a fancy way of demonstrating that you can use basically any function as an exception.
Custom Comparison and Sorting
Again, RTFM.
Tying Methods to Objects
Or, "let me demonstrate again how I haven't RTFM". See also: call(), apply(), and the prototypal inheritance.
last one isn't wrong. Depends on the platform. in IE it's totally true ... although probably not in the upcoming ie10. If the article was dated say March 3, 2008, it would be universally true.
ok. I'm being serious here, I'll get back to you after I catch this train. I know for a fact that push was faster than += historically; I was pretty vocal about making that no longer the case a few years back. I thought IE8 had the problem still, but I could be wrong; unless not all IE8s use the same JScript revision core.
4
u/kenman Sep 06 '12
Ugh, another problematic "tricks" article.
Deeply Nested Objects
This is not a "trick", it's JS 101. RTFM.
Static Local Variables
This one can be useful, but it's misnamed as they're not local.
Assertion
A better title would have been "how to make your own exceptions", which is a fancy way of demonstrating that you can use basically any function as an exception.
Custom Comparison and Sorting
Again, RTFM.
Tying Methods to Objects
Or, "let me demonstrate again how I haven't RTFM". See also: call(), apply(), and the prototypal inheritance.
Concatenating Strings vs. Array.join
I believe this one is flat-out wrong.