- String - A sequence of text known as a string. To signify that the variable is a string, you should enclose it in quote marks.
var myVariable = 'Bob';
-
Number - A number. Numbers don’t have quotes around them.
var myVariable = 10;
-
Boolean - A True/False value. The words true and false are special keywords in JS, and don’t need quotes.
var myVariable = true //or false
-
Array - A structure that allows you to store multiple values in one single reference.
var myVariable = [1,'Bob','Steve',10];
Refer to each member of the array like this:
myVariable[0], myVariable[1], etc.
-
Object - Basically, anything. Everything in JavaScript is an object, and can be stored in a variable. Keep this in mind as you learn.
var myVariable = document.querySelector('h1');