Closed
Description
http://learn.jquery.com/performance/clever-conditionals/
jsperf: http://jsperf.com/jquery-clever-conditionals
The "better" way (using a regex) is 94% slower than the "old way" (simple equality comparison), and I would argue that it's also much less obviously understandable when skimming over code.
The object literal lookup method is also 78% slower than the "old way", but it's not implied that it's "better". I'm not sure what the point is of this example as it's almost as slow and hard to read as the "better" way.
Also, the "old way" should probably use the triple-equals for comparison.
Metadata
Metadata
Assignees
Labels
No labels