Figure 1.Code Structure
There are a couple of things that make up a JS source file,
Literals - e.g. 10 is Number literal, “Hello” is a string literal. They are used to assign values to variables.
Expression - involves operand(s) and operators. e.g.
a + b or
1 + a or
15 % 12
Statement - similar to expressions. They are (optionally) terminated by semicolon. They can be written either inside a function or outside a function
Get the Newsletter
We can send tutorials straight to your inbox.SUBSCRIBE