JavaScript has eight fundamental data types, which can be categorized into primitive and non-primitive (reference) types.ππ
πΉPrimitive Data Types (Immutable)
1. Number β Represents numeric values (integers and floating-point numbers).
let num = 42;
let price = 99.99;
---------------------------------------
2. BigInt β Used for very large integers beyond Number.MAX_SAFE_INTEGER
let bigNum = 9007199254740991n;
---------------------------------------
3. String β Represents text data
let name = "John Doe";
---------------------------------------
4. Boolean β Represents true or false
let isLoggedIn = true;
---------------------------------------
5. Undefined β A variable that has been declared but not assigned a value.
let x;
console.log(x); // undefined
---------------------------------------
6. Null β Represents an intentional absence of value.
let emptyValue = null;
---------------------------------------
7. Symbol β Represents a unique and immutable identifier (used for object properties).
let sym = Symbol("unique");
---------------------------------------
πΉNon-Primitive Data Type (Mutable, Reference Type)
8. Object β A collection of key-value pairs (arrays, functions, and other objects fall under this).
let person = { name: "Alice", age: 25 };
let arr = [1, 2, 3];
let func = function () { console.log("Hello"); };
---------------------------------------
Special Cases
Arrays ([]) β Special type of object for ordered lists.
Functions (function) β Objects with executable code.
Date, RegExp, Map, Set, WeakMap, WeakSet β Specialized objects.
#JavaScript #LearnJavaScript #JavaScriptTutorial #JSDataTypes #JSBasics #WebDevelopment #CodingTips #FrontendDevelopment #react #FullStackDeveloper #coder #coding #react
#ProgrammingForBeginners #CodeNewbie #100DaysOfCode #TechEducation #tips #SoftwareEngineering #CodingLife #javascript