Closing Javascript Statements

Tell us what’s happening:
When do I need to put a semicolon (; ) after the closing brace (}) when writing javascript? Thanks!

Plug that question into Google. You’ll get multiple, good resources to read.

1 Like

I think you only need them when declaring objects:

var foo = {
  bar: 'baz'
};

But, if you don’t have some ESlint rule; "use strict"; declaration or if you’re not using TypeScript; you can get away with not putting the semicolon after an object declaration.

1 Like