yesterday I was disucsing with more experienced programmer. He saw that I am using
for (var i =0; i< 6; i++)
So 6 is the static number. I was iterating throug array. He said to use lengh, just in case array lemngh is not 6. I say - its always 6. Its not planned to be not 6.
He says still - who knows maybe code will be changed.
Ok, there might be some reason. But then I say - for me it looks more readable.
When I see 6 - I know its 6 and nothing else. WHen I see .lenght - then it automatically comes to my mind - this is not constant. So then I should make a commend for the code reader that its constant to not make him wasted time figuring out why can it be sometimes other than 6.
And even if its some time not 6, then it means ther is a bug in some other place which generates this array, so that bug needs to be fixed.
WHat do you think - what is better - the way I do or the way he says?