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.
Problems and Solutions
Iterating through and object that was inherited will return all prototypal members unless you use 'hasOwnProperty()'.
Variables need to be declared at the top of your functions. All variable declaration from within the function is done first and then function code is executed. Learn more about hoisting here: http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting and here: http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-javascript-hoisting-explained/
Always use a radix when using parseInt: parseInt('08', 10)
Performance
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...
Updating a variable and then editing the DOM once is much faster than updating the DOM multiple times!
