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.


Has this been helpful to you?

You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊

Kofi

Share & Discuss on