Originally posted by ccoder
Your for loop only executes when i = 1 and 2.

Change for(var i=1;i<3;i++) to for(var i=1;i<=4;i++)
I believe this would be faster:

Code:
for(var i = 0; i < 4; i++)
Than using <=.

At least in C++, it is. But I'm sure speed isn't an issue with this. It's most likely unnoticable.

But my teacher always heckles us with speed issues since he works on coding airplane response units, and you want them to be as fast as can be.

Just thought I'd buzz in.