loading...

re: JavaScript Best Practices for Beginners VIEW POST

TOP OF THREAD FULL DISCUSSION
re: 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...
 

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