Tips to keep a clean and neat javascript code

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 ..

     const timer=()=>{
/*here we incremented the time variable by one each time the timer function runs */
//output 1
//lets call timer function back


Always indent your codes .. to make it readable

  • most IDE's now has auto indention so by indenting your codes 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


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 ');

      name('Yhoung dev ');

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

Ahmed Bankole's photo

Great article bro

Yusuf Abdulrahman's photo


Emmanuel's photo

Thanks alot sir

Emmanuel's photo

Thanks alot boss

Precious Oladele's photo

Nice one bro

Emmanuel's photo

Thanks alot sir