Turns on the "latedef" switch for jshint to prevent time-wasting bugs.

http://www.jshint.com/docs/ has details and a link with a great deal more info.  I spoke to Anton (jshint maintainer), and he said that the only reason it's not on by default is for backwards compatibility.

This PR also includes a fix for one instance of this problem in tree.