Awesome article. Clean code and good practices should be a must topic to learn.
One opinion, though. I think 1. Conditionals needs more explanation about why is wrong to use a negative condition because negative conditions are frequently used in Guard Clauses.
Actually, Tip #1 and #14 would be similar.
Thanks!
I really liked this article.
I just got a point that in the section 08 the good example have a simple error. That code:
const { add, subtract } = require('./calculations')
add(4,2);
calculate.subtract(4,2);
should be:
const { add, subtract } = require('./calculations')
add(4,2);
subtract(4,2);
Thank you for the article.
It seems like point 14 example doesn't follow the rules you talk about yourself. For example:
function isPercentage(val) {
...
}
This function should be named checkIfInRange or something that makes it more obvious that it is a function. To me as a developer something that is prefixed with is, will most likely be a boolean.
In my opinion a better approach at this is:
function checkIfInRange(amount) {
return (amount >= 0 && amount <= 100);
}
const isInRange = checkIfInRange(78);
console.log(isInRange); // true
Now that I have set the thumbnail of this post as my wallpaper, I think I won't make the mistake again
Shubham Kumar Singh
Problem Solver | Full Stack Developer
Thank you very helpful Apoorv Tyagi