What is an Expression in JavaScript

By Hemanta Sundaray on 2021-07-25

An expression is any valid JavaScript code that resolves to a value.

This means, it's any JavaScript code that has an end result, for example:

  • 1 + 2
  • typeof(4)
  • new Date()
  • 2 * 4

And the list goes on...

Every one of these expressions, resolves to a value, for example:

  • 1 + 2 resolve to the number 3
  • typeof(4) resolves to the primitive data type number
  • new Date() resolves to a date object
  • 2 * 4 resolves to the number 8

Join the Newsletter