JavaScript
Fundamental
DATA TYPES
📌 What is a variable?
A variable is like a box where you can store
something — like a number, a word, or even a
whole list!
🧩 1) Primitive Data Types
simplest types of values
Examples include:
number - 1, 2, 105, 3.14
string - 'a', "one", 'World Wide Web'
boolean - true, false
undefined - Indicates absence or unknown value
null - Special keyword: value = "none" or "empty"
✅ But variable is still defined
🧱 2) Objects
Anything that’s not a primitive is an object.
Examples are:
An object that stores a person’s details.
Arrays (lists).
Functions (which do something).
JavaScript does not have types for variables
🔸 JavaScript is a weakly typed language:
You don’t declare a variable's type explicitly.
✅ Checking the Type with typeof
Let’s see how to find out the type:
typeof x; // "number"
typeof name; // "string"
typeof michel; // "object"
📝 Recap and Key Takeaways
🎉 Great job! Let’s wrap up:
✅ Variables in JavaScript can store primitive data types or objects.
✅ You don’t have to declare the type — JavaScript figures it out for you!
✅ Use the typeof operator to check what kind of value you have.
✅ Remember: simple = primitive, collections = objects.
👉 Practice:
1️⃣ Create a variable for your age, your name, and whether you are a
student (true or false).
2️⃣ Use typeof to log the type of each variable.