Understanding Data Types in JavaScript πŸš€ | JavaScript Journey | In Hindi | Death Code - DeathCode

JavaScript Data Types Example

let age = 45; // Number 
let price = 4.5; // Number 
let bigInt = 2983293742934128346283746283453n; // BigInt 
let myName = "DeathCode"; // String 
let isStudent = true; // Boolean 
let isAdult = false; // Boolean 
let khali; // Undefined 
let temp = null; // Null 
let arr = [4, "hello", age, khali, temp, price, bigInt, isStudent, myName]; // Array 
let obj = { key: "value", myAge: 99 }; // Object 
console.log(obj.myAge); // Outputs: 99
 

Data Types Explained

  • Number: Represents both integer and floating-point numbers.
  • BigInt: Represents integers with arbitrary precision, denoted by an 'n' at the end.
  • String: Represents a sequence of characters enclosed in quotes.
  • Boolean: Represents a logical entity and can have two values: true or false.
  • Undefined: A variable that has been declared but has not yet been assigned a value.
  • Null: Represents the intentional absence of any object value.Array: A collection of items stored in a single variable, which can hold multiple data types.
  • Object: A collection of key-value pairs, where keys are strings and values can be any data type.
Β© 2024 DeathCode. All Rights Reserved.