measurethat.net
jsben.ch
jsbench.me
jsperf.com
These tools are useful for looking at execution times. In my investigations a couple years ago I found that the second method you stated is indeed faster (due to not having to execute the n*n calculation every iteration. However, browsers/systems may have changed since then and as j said some caching may be involved.
Overall though, if I recall correctly, for simple loops a faster alternative is using a while loop.