JavaScript Values

Information is everything, and in JavaScript every piece of information is known as a value. Because many kinds of information exist in the world, there are many kinds of values to choose from. However, to simplify things, the simplest building blocks of all information in JavaScript are known as primitive types.

The three main primitive types are

  • String

  • Number

  • Boolean

Strings

Probably the most common value is a string. A string is a chain of characters that can include letters, punctuation marks, and numerals, which are literally strung together. In JavaScript, strings usually represent text.

The following are all examples of strings:

Hello and welcome!
Who are you?
I am 6 feet tall

Strings can be included in your JavaScript ...

Get JavaScript™ 1.5 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.