Data Types in JavaScript
Let's dive deeper into JavaScript data types, exploring their characteristics, usage, and additional details.

Greetings! I'm Magnifiques 📿, a web developer and UI/UX designer passionate about creating amazing digital experiences. I specialize in ReactJS and JavaScript, and my projects highlight my expertise with the ReactJS library. I also use Node.js and Express.js for backend development and Figma for designing user-friendly interfaces. I'm committed to delivering top-quality solutions that exceed user expectations.
JavaScript data types can be divided into two main categories:
Primitive
Object.
Primitive Data Types
There are a total 7 primitive data types in JavaScript
Number: Represents both integer and floating-point numbers. JavaScript uses a 64-bit floating-point representation for numbers.
let count = 12; let cost = 145.62; let age = 42;String: A string is a sequence of characters. It is mainly used to define the texts.
let firstName = 'Alexander' let iceCream = 'Strawberry'Boolean: Boolean is a logical type that can be "True" or "False". It's used for making decisions.
let isCustomer = True let isOverdue = FalseUndefined: Value taken by a variable that is not defined. It's an empty value. A variable is declared but not assigned a value.
let customer; console.log(customer) // Output: undefinedNull: It is also an empty value treated as a falsy value.
let orders = null; console.log(customer) // Output: nullSymbol: It is introduced in ES2015 (or ES6). A symbol represents a unique value and it can not be changed.
let symbol1 = Symbol('description'); let symbol2 = Symbol('description'); console.log(symbol1 === symbol2); // Output: falseBigInt: BigInt is introduced in ES2020. It can hold larger integers than the type Number can hold.
let bigInt = BigInt(9808797867887687574567890);
Javascript has dynamic typing. You don't have to manually define the data type of the value stored in a variable. Javascript does it for you internally. This means you don't have to assign the type such as String or Number to the value.
Also, In Javascript, it's the value that has the type, not the variable. Variable just stores the value that has the type.
let customer = "Julia";
console.log(customer) //Output: "Julia"
customer = True
console.log(customer) //Output: True
Conclusion
JavaScript has a rich set of data types, each serving a different purpose. Understanding these types and how to use them effectively is crucial for writing robust and efficient JavaScript code.



