For a clear understanding of the explained concepts below, I suggest you use your developer console tool and run the examples and confirm the results and you'll understand the concepts more clearly.
let's start with a function as follows;
The first variable (value1) is undefined
The second variable (value2) turns into a global variable evident when we access it inside and outside of the function scope, which in this scenario is far from what was intended.
In this second example we will see the impact of line breaks and semicolons in a function that has a returning value;
To prove this, all you have to do is remove the + operator before the value 3 and have the code look as follows;
These issues are easily resolved in major code editors by using lint tools which are very good at correcting these errors for you.