ReferenceError

noun

say it: “REF-er-ens AIR-er” /ˈrɛfərəns ˈɛrər/

The error JavaScript stops with when code uses a name it can't find, often a typo or a variable that was never created.

What is ReferenceError in JavaScript?

ReferenceError — The error JavaScript stops with when your code uses a name it doesn't know: a typo such as consol, or a variable that was never declared. The message names the missing word, so check its spelling first.

const lattePrice = 4.75;
console.log(latePrice); // ReferenceError: latePrice is not defined

In a sentence

  • “I typed totl instead of total and got a ReferenceError: totl is not defined.”

Level: Novice · More JavaScript terms at this level

Updated