Why am i seeing "referenceerror: x is not defined" in javascript?

Example:

console.log(variable);

This error occurs when you reference a variable that has not been previously defined.

Solution: Make sure you declare your variable before you use it.

let variable = "Hello, World!";
console.log(variable);

Beginner's Guide to JavaScript