JavaScript: Expressions

1console.log(5 + 3)

Look in a mirror and repeat this to yourself 1,000 times, or however many times it takes, because it will save you a lot of pain:

I WILL NOT read this code as "It prints five plus three".

I WILL NOT read this code as "It prints five plus three".

I WILL NOT read this code as "It prints five plus three".

Be awesome and read it this way instead:

The expression 5 + 3 resolves to the literal integer 8, and then it prints that resultant value.

You may not fully understand this right now, but DO NOT forget this

The expression 5 + 3 is unresolved

That word, "unresolved", is critically important for your ability to understand how code actually works

Nothing will enter the console.log function until it is a fully resolved, literal value

Here is how the code actually resolves and is processed:

1// Step 1: The Original Code
2console.log(5 + 3)
3
4// Step 2: The Expression Resolves to a Literal Integer
5console.log(8)
6
7// Step 3: The Literal Integer is Printed
8// Prints: 8