Data types are the building blocks of all languages and essential pieces of any program.
console.log('New York City'); console.log(40.7); console.log(true); console.log(null);
In the example above, the computer logs each of the four primitive data types to the console. The types include:
Strings — Any grouping of keyboard characters (letters, spaces, numbers, or symbols) surrounded by single quotes (‘Hello’) or double quotes (“World!”). In the example above, ‘New York City’ is a string.
Numbers — Any number, including numbers with decimals: 4, 1516, .002, 23.42. In the example above, 40.7 is a number.
Booleans — Either true or false, with no quotations. In the example above, true is a boolean.
Null — Can only be null. It represents the absence of value.
Let’s review: a string is any grouping of words, a number’s a number, null is the absence of value, and a boolean is either true or false.