DEV Community

Discussion on: Understanding Javascript Array Series V - Array Loops & Iteration Part II

Collapse
 
rolandcsibrei profile image
Roland Csibrei • Edited

How can you use a variable name "size" for index access? This is a very bad idea. Sure, this is only a short example, however you are seeding the devil into the newcomers minds. Variable naming is crucial. Another thing is that the index variable should be initialized to size-1 when entering the while loop and should be decremented at the end for better readibility. Just my three-- cents.

Collapse
 
nedyudombat profile image
Nedy Udombat

Hi @rolandcsibrei , thank you for the correction, I appreciate it. But however what I will not appreciate is this statement however you are seeding the devil into the newcomers minds. If you want to give someone feedback make it ASK(Actionable, Specific and Kind). Thank you.

Collapse
 
rolandcsibrei profile image
Roland Csibrei

Sorry, I didn't want to be offending. I apologize.