DEV Community

Paolo Ventura
Paolo Ventura

Posted on

JS Definitive Guide Ch. 2

Chapter 2: Lexical Structure:

JS ignores spaces and for the most part ignores line breaks. This allows us to format code easily in a readable way.

Variables can be declared starting with a letter, - or $.

There are a few reserved keywords that should be avoided.
I did not know that you can declare a variable called let using var in the global scope, mindblown!

You can use unicode escape characters. However, it is important to normalize them if used in declaring a variable because you might otherwise have two indistinguishable variables.

Semi colons do not have to be used but if not... there can be some weird interpretations.

Certain statements always invoke semi colon behaviour:

  1. return, break, continue (needs to be on same line as what returning)
  2. ++ (needs to be on same line as its variable)
  3. arrow (needs to be on the same line as the parameter list)

Top comments (0)