10 Good practices that make a Javascript developer Professional

Hrridoy V2
3 min readNov 3, 2020

--

1. Comments

Using comments in codding, is good practice for all developer. Commenting in a codding make the project self-descriptive, easy readable. In Javascript there are two kinds of comments. // is used for single-line comment and /*…*/ is used for multi-line comment.

2. Recipe: factor out functions

Many lines of coding is hard to read and understand. So, sometimes replacing some line code with a function make the coding readable easy.

3. Curly Braces

Mixer of opening brace and curly brace without space makes the coding hard readable. One space between opening brace and curly brace make code professional.

4. Line Length

Lot of texts in just one it makes reader boring. Split them to more line is more easy readable.

5. Semicolons

After line semicolon is mandatory in some programing language. In javascript , though it is not wrong in technically, but to make code easy readable professional developer should practice it all time.

6. Function Placement

Sometimes, many lines of coding in a function is hard to read, so replacement these lines with a function should be practice. But placement is also important. Helper functions should use below the main coding. That make coding more readable and self-descriptive.

7. Use array spreads … to copy arrays

Sometimes we need to copy the full array, instead of looping spreads is more easy and good practices for javascript developer.

8. Use single quotes ‘ ’ for normal string

For normal line string instead of double quotes or template, single quotes makes code more good looking.

9. Use named function expressions instead of function declarations

Named functions is easy to reuse, sometimes name of function tell that why the function is made for. So, reader can easily understand about code.

10. Never name a parameter ‘arguments’

By default, for every function scope there is a arguments object. So, if you name a parameter as arguments, it will take precedence over the arguments object.

--

--

Hrridoy V2
Hrridoy V2

No responses yet