Non-declared variables

it's not the actual typing of the lines that takes so long -
it's reasoning over it.

...and yet (for me) the actual typing of the lines *is* a significant
portion, even though I'm a reasonably fast typer. I just performed a
simple test to be sure.

It took me 45 seconds to type (the Ruby code):
  myArray.each{ |a,b|
    alert( a, b )
  }
five times in a row.

It took me 60 seconds to type (the JS code):
  for ( var i=0, len=this.length; i<len; ++i ){
    alert( this[0], this[1] );
  }
five times. I type that loop ALL THE TIME. My muscle memory is attuned
to that loop, and cranks it out.

It took me 65 seconds to type (the JS code):
  myArray.each( this, function( a, b ){
    alert( a, b );
  } );
five times. And, I made a typo on the fourth attempt that I didn't see
until I was done.

This is obviously a very simple test, but I'm telling you that, in this
case, saving keystrokes reduces my programming time on a task by 25%. I
write JS all day long, and I cringe every time I need to iterate an
array. (Cringing time not included in the above measurements.)

···

From: ara.t.howard@noaa.gov [mailto:ara.t.howard@noaa.gov]