CHAPTER 3Fundamentals
Javascript is an imperative language, in the C family. Code consists of lists of statements usually ending in a semi-colon (;
). Semicolons are optional but since they are inserted automatically, sometimes in particular cases they can mess up code.
Comments are like in C++ (//
single-line, and /*
+*/
multi-line).
Prettier
A good way not to fight semicolons (and many other style aspects) is to use a formatter like Prettier. Associating a key with formatting code and formatting it automatically often leads to consistent code in projects.