Follow the kiss method
Keeping your code as simple and stupid is one characteristic of a good developer
Some easy Tips for writing neat and understandable JavaScript code
By following the KISS method
the kiss method says Keep it simple and stupid
Use of comments
always use comments when writing codes .. Especially when writing a bulky code
It is always a good advice to use comments in your codes in other to denote or remember what a code does , and also it will make other developers understand your codes easily ..
time=0;
const timer=()=>{
time++;
/*here we incremented the time variable by one each time the timer function runs */
console.log(time);
//output 1
}
timer();
//lets call timer function back
INDENTION
Always indent your codes .. to make it readable
- most IDE's now has auto indention so by indenting your codes ..it makes your code more easier to read and neat
It is expected of you to always indent nested loops and functions properly
KNOW HOW TO USE let , const and var keywords
When u know how and where to use the const , let and var it also makes your code neat
Use OOP
Using Object Oriented Programming makes your code easy to understand and neat
* You can use any method you are familiar with
if you are using functional programming always place your functions in the right manner .. it is a good advice for you to call a function inside another function block , because it makes your code clean and neat
(()=>{
name=code=>console.log('thanks for reading ');
example=()=>{
name('Yhoung dev ');
}
example();
();
You can only call a function inside another function when you want run a block of code in the parent function
Writing a neat and clean code is stress free