Marcel Mokos
Sep 3, 2018 · 1 min read

You are writing about comments, but for me, the most important are variable and function names.
Some developer use one character variable names, I am strongly against it. It is better to use “index” instead of “i”. Some like to name things like “data”, “variable”, “term.” I like to describe everything in detail like “userData”, “loanTermInMounths”, “loanInterestPerYear”…
When you name thing right, some comments are not needed. I prefer to have these long names and no comments.

type Props = {
/* loan term in mounts */ /* COMMENT NOT NEEDED */
“loanTermInMounths”: number
}

A good practice is to use an object argument if there are more then 2 arguments for the function. Better to autocomplete it with type checking then to call a function with undefined, or null in its arguments “fn(1, undefined, “,”)”

Marcel Mokos

Written by

I'm fanatic to next generation Javascript lambda, yield, async/await everything. I admire typescript and flow types. Javascript will ultimately rule the world.