I keep getting errors! What’s one easy way to fix them?
To first fix an error we need to know what’s causing them! When you get an error look at the error message in the console. It’ll first tell you the file in which the error is coming from and the line number followed by the line itself. Example:
/PATH/TO/DIRECTORY/file.js:7 var line = Gives error
Here we have the path to the directory of the file, the filename (
file.js), and what line number is causing the error (7). It then shows us the line that caused the error and is then followed by the error message:
SyntaxError: Unexpected identifier at ... ...
Gives error. Adding the quotes fixes the problem and the error.