Earlier quoted context omitted.
JavaScript is complex enough that pretty much any code inside of the loop could end up doing an array push. Even `console.log(myCompletelyUnrelatedObject.x)` (given an evil property descriptor).
Not if the function is inlineable or an intrinsic (console.log will likely be either), which is the most basic trick of any JIT. Unless you can specifically measure caching the length is faster, I wouldn't do it. Most of the time it doesn't matter anyway (won't cause a bump in performance), and even then most of the time the compiler will be able to figure it out for you.
function adder(arr, obj) {
for (var i = 0; i