HTML CSS JavaScript SEO Python Posts Privacy About Contact

JS Data Types

JavaScript variables can hold different data types: strings, numbers, booleans, objects, arrays, and more.

JavaScript is dynamically typed — a variable can hold any type of data, and the type can change at runtime. Use typeof to check any variable’s type.

Try It — All Data Types

Preview

Data Types at a Glance

TypeExampletypeof result
String"Hello""string"
Number42, 3.14"number"
Booleantrue, false"boolean"
Undefinedlet x;"undefined"
Nullnull"object" (JS quirk)
Object{ key: value }"object"
Array[1, 2, 3]"object"

Tip: Arrays are technically objects in JavaScript. Use Array.isArray(value) to reliably test if something is an array.