What is a Literal in JavaScript?

In JavaScript, a literal is when you refer to a value by literally writing it in your script file.

There are different types of literals:

  • 4 is a number literal
  • "Icecream" is a string literal
  • {color: "red"} is an object literal

More about object literals here.