string represents string values like "Hello, world"
number is for numbers like 42. JavaScript does not have a special runtime value for integers, so there’s no equivalent to int or float - everything is simply number
boolean is for the two values true and false
The type names String, Number, and Boolean (starting with capital letters)
are legal, but refer to some special built-in types that will very rarely appear in your code.
Always use string, number, or boolean for types.
The primitives: string, number and boolean
string
represents string values like"Hello, world"
number
is for numbers like42
. JavaScript does not have a special runtime value for integers, so there’s no equivalent toint
orfloat
- everything is simply numberboolean
is for the two valuestrue
andfalse