Literals and Variables

The simplest form of an expression is a literal, which means something that evaluates to itself, such as the number 22 or the string “Press Enter”. An expression could also be a variable, which evaluates to the value that has been assigned to it. They are both types of expressions, because they return a value.
 
Following Example shows five different literals, all of which return values, albeit of different types:

<script>
myname = "Peter"
myage = 24
document.write("a: " + 42 + "<br />") // Numeric literal
document.write("b: " + "Hi" + "<br />") // String literal
document.write("c: " + true + "<br />") // Constant literal
document.write("d: " + myname + "<br />") // Variable string literal
document.write("e: " + myage + "<br />") // Variable numeric literal
</script>