# Re: Non-declared variables

**URL:** <https://www.ruby-forum.com/t/re-non-declared-variables/72361>\
**Category:** Ruby\
**Created:** [October 16, 2006, 7:05pm UTC](https://www.ruby-forum.com/t/re-non-declared-variables/72361 "2006-10-16T19:05:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [October 16, 2006, 7:05pm UTC](https://www.ruby-forum.com/t/re-non-declared-variables/72361/1 "2006-10-16T19:05:12Z")

</div>

From: removed\_email\_address@domain.invalid [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

> 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.)
