JS Tutorial



JS DATATYPES


JavaScript Data Types

In JavaScript, data types define the kind of value a variable can hold.

๐Ÿ“Œ Note: JavaScript is a dynamically typed language.

๐Ÿ“ฆ 1. Primitive Data Types

  • String โ€“ Textual data
  • Number โ€“ Integer or float
  • Boolean โ€“ true or false
  • Undefined โ€“ Declared but not assigned
  • Null โ€“ Intentionally empty
  • BigInt โ€“ Very large numbers
  • Symbol โ€“ Unique identifiers
let name = "John";
let age = 25;
let isStudent = true;
let score;
let empty = null;
let big = 12345678901234567890n;
let id = Symbol("id");

๐Ÿ“ฆ 2. Non-Primitive (Reference) Data Types

  • Object โ€“ Key-value pairs
  • Array โ€“ Ordered list
  • Function โ€“ Reusable code block
let person = { name: "Alice", age: 30 };
let fruits = ["apple", "banana"];
function greet() {
  return "Hello!";
}

๐Ÿ” Using typeof

console.log(typeof "Hello");
console.log(typeof 123);
console.log(typeof true);
console.log(typeof undefined);
console.log(typeof null);
console.log(typeof {});
console.log(typeof []);
console.log(typeof greet);

๐Ÿงช Try it Yourself

Result will appear here
๐Ÿ“˜ Summary:
JavaScript has primitive and non-primitive data types. Use typeof to identify them.

๐ŸŒŸ Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review