In JavaScript, understanding variables and data types is crucial for effective programming. This knowledge forms the foundation for managing data and controlling program behavior .
Aspect Description Variables Containers for storing data values. Declaration Keywords – var
: Function-scoped or globally-scoped. – let
: Block-scoped and reassignable. – const
: Block-scoped and immutable after assignment.
Data Types
Data Type Description Example Number Represents both integer and floating-point numbers. let num = 42;
String A sequence of characters enclosed in quotes. let str = "Hello, World!";
Boolean Represents a logical entity with two values: true
or false
. let isActive = true;
Null Represents the intentional absence of any value. let emptyValue = null;
Undefined Indicates that a variable has been declared but not assigned a value. let notAssigned;
Symbol A unique and immutable primitive value used as an identifier. const sym = Symbol('description');
BigInt Represents integers with arbitrary precision. const bigIntValue = BigInt(12345678901234567890);
Object A complex data type that can store collections of data. const person = { name: "John", age: 30 };
Array A special type of object used to store ordered collections. const fruits = ["apple", "banana", "cherry"];
Function Functions are also objects and can be treated as first-class citizens. function greet() { return "Hello!"; }
Checking Data Types
Method Description typeof
Returns the type of a variable as a string.
Example Usage
javascriptconsole.log(typeof num); // "number"
console.log(typeof str); // "string"
console.log(typeof isActive); // "boolean"
This table provides a clear and organized overview of variables and data types in JavaScript, making it easy to reference key concepts at a glance!
Important Links
Company Job/Internship Link
Wyreflow Technologies Career Page Link
Agoda 2025 Hiring (Closed Jobs) Link
L&T Hiring 2024 for Freshers Link
Wipro Off Campus Recruitment Drive 2024 Link
PM Internship Scheme 2024 Registration Online Guide Link
Tata Sales Internship for Freshers (Stipend ā¹7k) Link
Makerble Fullstack Developer Internship Link
Atlassian Internship Openings 2025 Link
Zenatix Entry-level Job Opportunities 2024 Link
Worley Fresher Vacancies 2024 Link
Wipro Off Campus Recruitment Drive 2024 Link
Google Off Campus Drive 2024 Link
American Express Off Campus Drive 2024 Link
Amazon Entry Level Jobs 2024 Link
Google Internship Openings 2025 Link
Related