JavaScript Expressions

JavaScript expressions either assign a value to a variable or simply have a value. An expression is a unit of code that resolves to a value.

The following are the different categories for expressions:

  • Arithmetic: resolves to a number
  • String: resolves to a string
  • Logical: resolves to true or false
  • Object: resolves to an object

x = 4 + y  // an arithmetic expression
"Good-bye" + fName  // a string expression
testY && testZ  //a logical expression