loading...

re: JavaScript Best Practices for Beginners VIEW POST

FULL DISCUSSION
 

I agree with most of these, except the semicolon one. It's perfectly fine if you don't use them.

I think what this article is missing is a section about consistency. Double quotes vs single quotes? Semicolons or not? It doesn't matter as long as you're consistent with it. Also, you could perhaps suggest using ESLint.

 

Thanks for the suggestion. I'll include that too..
Have a good day😋

 
 

I'd argue that beginners should use semicolons to understand the implications of writing without them.

For the most part you shouldn't have any issues, but there are some gotchas that will trip up beginners.

For example,

const test = () => {
 return 
 {
  ok : true
 }
}
console.log(test())

In the eyes of a beginner, what do they expect this code to do? If they're not used to writing with semicolons they might expect it to return the object, but instead they get undefined.

I do 100% agree about consistency. Whichever way you go, be consistent.

code of conduct - report abuse