daemonl

In case you were wondering...

JS108 - Conventions

You may have noticed that there are usually a few ways of doing something in JavaScript. You can even be really clever with one line hacks to get what you want. And you shouldn't do that.

It doesn't matter what convention you choose, but best to choose one and stick to it for each project.

I use https://github.com/rwldrn/idiomatic.js/

It's mostly about indenting, whitespace and capital letters - things which don't change how the program works, but also rules like use === unless you actually want it to convert.

It's very specific and harsh. But it will make your code easier to read by other people. It's your responsibility to make your code readable. You shouldn't be trying to complicate it. Programming is a language you use to express your idea. If you have to gloss over it with complicated syntax which isn't needed, you may be trying to cover up a bad idea. You are very talented, and your ideas are worthwhile. Don't hide behind crappy code, let us see what you have!

To quote from idiomatic:

The following code is an example of egregious naming:

function q(s) {return document.querySelectorAll(s);}  
var i,a=[],els=q("#foo");  
for(i=0;i=els.length;i++){a.push(els[i]);}

Without a doubt, you've written code like this - hopefully that ends today.