Numbers, Strings & Booleans

Learn JavaScript's most basic variable types: numbers, strings, and booleans. Learn how to use and work with variables.

Types of Variables

There are a few different types of variables in JavaScript. We’ll discuss numbers, strings, and booleans first.

Numbers

Numbers are just what you’d expect and what we’ve been using in the examples above. 19, 30, 924311933 are all numbers. We can’t use commas, spaces, or other characters when we create numbers. We have to use continuous digits.

Strings

Strings are different. We can think of them as the way we represent text in JavaScript. They’re created using the ' and " characters. For example, if we wanted to store a representation of the word Hello in JavaScript, we could write it two different ways.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy