A data type
is the kind of data that can be used in a language, and also describes the way that we represent information, or data. Data types
include:
- String - Used to represent text, in quotations
- Number
- Integer - A whole number which can be positive, negative, or zero
- Float - A number with a decimal, which can be positive or negative
- Boolean - A piece of data that is only represented as true or fasle
- Array - A group of multiple pieces of the same type of data, contained in brackets, and separated by commas.
String
var first_pizza = "New York Style";
var second_pizza = "Chicago Style";
Number
var height = 9;
var width = 7.2;
Boolean
var happy = true;
var open = false;
Array
var class_mates = ["Soraya", "Duncan", "Miguel"];
var distances = [23, 17, 18, 45, 81];