DEV Community

Discussion on: Seeking advice for best practices on formatting code

Collapse
 
sfiquet profile image
Sylvie Fiquet

I'm not entirely sure what you're asking. Maybe add a link to the SO interaction so we have some context. I'm going to assume you're not talking about formatting code in markdown.

The whole point of formatting code is to make it easier for other people to read. That includes you in six months time when you have forgotten everything about the program.

In general each programming community has its own standards. Given your profile, I assume it's JavaScript you're talking about? Maybe google for "Javascript style guide", there are a few around. I found this article that lists five of them. Which one to use? It doesn't matter, you use whichever style guide your company/uni has picked. As an independent learner you can pick any you like.

There are tools called linters that you run on your code to check if it conforms to the chosen standard. It helps you catch bugs early, e.g. a typo in a variable name will cause an undeclared variable error. Eslint is a popular one.

Collapse
 
kurtreyn profile image
Kurt Reynolds

This helps a lot. Thank you for the reply.