Comparisons rss

Problems and Solutions

Consecutive Dollar Signs and Regex

This was a recent issue that I came across. I'm not sure that escaping a dollar sign with another dollar sign is a good practice, but I had no luck tracking down an elegant solution.

Performance

‘with’ with JavaScript

The performance implications of 'with' aren't apparent until you try to access an identifier that doesn't reside in the passed object. It must first search this object for the identifier before looking elsewhere. In the 'anti-pattern' example above, 'obj1' must be searched through to see if it contains 'obj2' before searching the scope chain.
'with' is not allowed in ECMAScript 5 strict mode. Read more about JavaScript's 'with' statement...

Looping To Add To The DOM

Updating a variable and then editing the DOM once is much faster than updating the DOM multiple times!

Contact me if you're interested in writing some comparisons @dansnetwork

No Support