DEV Community

Discussion on: Coding Conventions for Writing JavaScript

Collapse
 
devdufutur profile image
Rudy Nappée

You certainly misreaded, he says don't use a $ as a prefix not as a suffix.

And even if you can use semiconlonless code, it shouldn't mean you have to. Semicolons improve readability of your code. Look at default configurations of JS code formatters like prettier...

(1) for (let i = 0; i < arr.length; i++)

is strictly equivalent to

(2) for (let i = 1; i <= arr.length; i++)

Even if I don't use this second form, some could argue it's more human readable (humans starts counting at 1 as far as i know).

Collapse
 
mateiadrielrafael profile image
Matei Adriel • Edited

A convention is something people decided is the best way to do somrthing. Since a lot of people don't use seimcolons it just means it's not a convention

Also, 99% of people start loops at 0, so why do it the other way around in a post about "conventions"