JavaScript data types
summarizing the building blocks of web app data
// updated 2025-05-02 07:11
We can categorize basic data types, known as primitives, as follows:
- Number
 - String
 - Boolean
 - null
 - undefined
 - Object
 
Number
A value we can calculate with another
- an integer like 
3,-1,0 - a floating point number like 
-273.15 
String
A value with one or more alphanumeric characters
- plain text like 
StringorHello, World! - plain text that has non-calculatable numbers like 
Price: $200- if we try to add a String that has 
2and another String that has2we willl get22instead of4 
 - if we try to add a String that has 
 
Boolean
A value of binary logic (either true or false)
- usually to test some logic statement like 
2 == 2(2 is equal to 2) - named after George Boole, a 19th century logician
 
null
A placeholder value that indicates that no value exists
- still considered a value
 
undefined
A response signifying the absolute lack of a value
- implies that no value exists, not even 
null 
Object
A value with a structure that consists of a set of properties (with each property having a name and a value), e.g.
var myObject = {
  username: "Jon",
  age: 100,
  alive: true  
}As we can see in the example above, each property itself has values that consist of the primitive data types of string, number and Boolean.
From this point, we can work with these objects (that consist of values of primitive data types) to make a representation of some facet of reality!