โ
Web Development Projects You Should Build as a Beginner ๐๐ป
1๏ธโฃ Landing Page
โค HTML and CSS basics
โค Responsive layout
โค Mobile-first design
โค Real use case like a product or service
2๏ธโฃ To-Do App
โค JavaScript events and DOM
โค CRUD operations
โค Local storage for data
โค Clean UI logic
3๏ธโฃ Weather App
โค REST API usage
โค Fetch and async handling
โค Error states
โค Real API data rendering
4๏ธโฃ Authentication App
โค Login and signup flow
โค Password hashing basics
โค JWT tokens
โค Protected routes
5๏ธโฃ Blog Application
โค Frontend with React
โค Backend with Express or Django
โค Database integration
โค Create, edit, delete posts
6๏ธโฃ E-commerce Mini App
โค Product listing
โค Cart logic
โค Checkout flow
โค State management
7๏ธโฃ Dashboard Project
โค Charts and tables
โค API-driven data
โค Pagination and filters
โค Admin-style layout
8๏ธโฃ Deployment Project
โค Deploy frontend on Vercel
โค Deploy backend on Render
โค Environment variables
โค Production-ready build
๐ก One solid project beats ten half-finished ones.
๐ฌ Tap โค๏ธ for more!
1๏ธโฃ Landing Page
โค HTML and CSS basics
โค Responsive layout
โค Mobile-first design
โค Real use case like a product or service
2๏ธโฃ To-Do App
โค JavaScript events and DOM
โค CRUD operations
โค Local storage for data
โค Clean UI logic
3๏ธโฃ Weather App
โค REST API usage
โค Fetch and async handling
โค Error states
โค Real API data rendering
4๏ธโฃ Authentication App
โค Login and signup flow
โค Password hashing basics
โค JWT tokens
โค Protected routes
5๏ธโฃ Blog Application
โค Frontend with React
โค Backend with Express or Django
โค Database integration
โค Create, edit, delete posts
6๏ธโฃ E-commerce Mini App
โค Product listing
โค Cart logic
โค Checkout flow
โค State management
7๏ธโฃ Dashboard Project
โค Charts and tables
โค API-driven data
โค Pagination and filters
โค Admin-style layout
8๏ธโฃ Deployment Project
โค Deploy frontend on Vercel
โค Deploy backend on Render
โค Environment variables
โค Production-ready build
๐ก One solid project beats ten half-finished ones.
๐ฌ Tap โค๏ธ for more!
โค8
๐ ๐ง๐ผ๐ฝ ๐ฏ ๐๐ฅ๐๐ ๐ฅ๐ฒ๐๐ผ๐๐ฟ๐ฐ๐ฒ๐ ๐๐ผ ๐๐ฒ๐ฎ๐ฟ๐ป ๐๐ป-๐๐ฒ๐บ๐ฎ๐ป๐ฑ ๐ง๐ฒ๐ฐ๐ต ๐ฆ๐ธ๐ถ๐น๐น๐ ๐ฅ
๐ซ Artificial Intelligence (AI)
๐ Data Analytics
๐ Cybersecurity
๐ ๐๐ป๐ฟ๐ผ๐น๐น ๐ณ๐ผ๐ฟ ๐๐ฅ๐๐ ๐:-
https://pdlink.in/4y2XyN1
๐ฏ Perfect for Students โข Freshers โข Beginners โข Tech Enthusiasts
๐ก Learn for FREE โ Build Skills โ Upgrade Your Career
๐ซ Artificial Intelligence (AI)
๐ Data Analytics
๐ Cybersecurity
๐ ๐๐ป๐ฟ๐ผ๐น๐น ๐ณ๐ผ๐ฟ ๐๐ฅ๐๐ ๐:-
https://pdlink.in/4y2XyN1
๐ฏ Perfect for Students โข Freshers โข Beginners โข Tech Enthusiasts
๐ก Learn for FREE โ Build Skills โ Upgrade Your Career
โค2
๐ ๐๐ฎ๐๐ฎ ๐๐ป๐ฎ๐น๐๐๐ถ๐ฐ๐ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป ๐๐ผ๐๐ฟ๐๐ฒ ๐๐ผ ๐๐ฒ๐ ๐ฎ ๐๐ถ๐ด๐ต-๐ฃ๐ฎ๐๐ถ๐ป๐ด ๐๐ผ๐ฏ ๐ถ๐ป ๐ฎ๐ฌ๐ฎ๐ฒ ๐
Build job-ready skills through live online classes, practical assignments and real-world projects.
๐ผ End-to-End Placement Support
๐ค 500+ Partner Companies
๐ 2000+ Students Placed
๐ Highest Salary: โน41 LPA
๐ Get FREE career counselling and check your eligibility!
๐ ๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐ก๐ผ๐ ๐
https://pdlink.in/45vk5ph
โกPrepare for roles such as Data Analyst, Business Analyst, BI Analyst and Reporting Analyst.
Build job-ready skills through live online classes, practical assignments and real-world projects.
๐ผ End-to-End Placement Support
๐ค 500+ Partner Companies
๐ 2000+ Students Placed
๐ Highest Salary: โน41 LPA
๐ Get FREE career counselling and check your eligibility!
๐ ๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐ก๐ผ๐ ๐
https://pdlink.in/45vk5ph
โกPrepare for roles such as Data Analyst, Business Analyst, BI Analyst and Reporting Analyst.
๐ฅ 8 skills = 8 free certifications >>>
AI (Microsoft) -
https://learn.microsoft.com/en-us/training/paths/get-started-artificial-intelligence/
Deep learning (NVIDIA) -
https://learn.nvidia.com/en-us/training/self-paced-courses
Data science (IBM) -
https://skillsbuild.org/students/course-catalog/data-science
Data Analyst (Microsoft) -
https://learn.microsoft.com/en-us/training/paths/data-analytics-microsoft/
Python (Microsoft) -
https://learn.microsoft.com/en-us/shows/intro-to-python-development/
SQL (Infosys) -
https://www.coursejoiner.com/freeonlinecourses/infosys-free-certification-course-9/
Java (Infosys) -
https://www.coursejoiner.com/uncategorized/infosys-launched-free-java-certification-course/
Cloud computing (AWS) -
https://explore.skillbuilder.aws/learn/course/134/aws-cloud-practitioner-essentials
React - โค๏ธ for more posts like this ๐
AI (Microsoft) -
https://learn.microsoft.com/en-us/training/paths/get-started-artificial-intelligence/
Deep learning (NVIDIA) -
https://learn.nvidia.com/en-us/training/self-paced-courses
Data science (IBM) -
https://skillsbuild.org/students/course-catalog/data-science
Data Analyst (Microsoft) -
https://learn.microsoft.com/en-us/training/paths/data-analytics-microsoft/
Python (Microsoft) -
https://learn.microsoft.com/en-us/shows/intro-to-python-development/
SQL (Infosys) -
https://www.coursejoiner.com/freeonlinecourses/infosys-free-certification-course-9/
Java (Infosys) -
https://www.coursejoiner.com/uncategorized/infosys-launched-free-java-certification-course/
Cloud computing (AWS) -
https://explore.skillbuilder.aws/learn/course/134/aws-cloud-practitioner-essentials
React - โค๏ธ for more posts like this ๐
โค1
๐ป JavaScript Roadmap 2026 โ Part 1
๐ฑ Programming Fundamentals
Before learning JavaScript syntax, it is important to understand what programming actually means.
1๏ธโฃ What is Programming?
Programming means giving a computer a set of instructions to perform a task.
For example:
Here, you are telling JavaScript to display:
Think of programming like giving instructions to a very literal assistant โ it does exactly what you tell it to do.
2๏ธโฃ What is JavaScript?
JavaScript is a programming language mainly used to make websites and applications interactive.
It can be used for:
๐น Websites
๐น Web applications
๐น Backend development
๐น Mobile applications
๐น Desktop applications
๐น APIs
๐น Automation
๐น AI-powered applications
3๏ธโฃ How JavaScript Works
When you write:
JavaScript produces:
JavaScript can run in different environments:
๐ Browser โ Chrome, Edge, Firefox, etc.
๐ข Node.js โ Server-side JavaScript
โก Other runtimes โ Modern JavaScript applications
4๏ธโฃ Variables
Variables are used to store values.
Here:
โ stores
/
โ stores
The two most important keywords:
can be reassigned.
cannot be reassigned.
5๏ธโฃ Basic Data Types
Later, you'll learn:
๐น Objects
๐น Arrays
๐น Functions
๐น Symbols
๐น BigInt
6๏ธโฃ Operators
You'll eventually learn:
โ Arithmetic operators
๐ Comparison operators
๐ง Logical operators
๐ Assignment operators
โ Ternary operator
7๏ธโฃ Conditions
8๏ธโฃ Loops
Output:
Later you'll learn: ๐น for๐น while๐น do...while๐น for...of๐น for...in
9๏ธโฃ Debugging
You need to learn how to:
๐น Read error messages
๐น Find the problematic line
๐น Use
๐น Use browser Developer Tools
๐น Use breakpoints
๐ง What You Should Know After Part 1
โ What programming means
โ What JavaScript is
โ Where JavaScript can run
โ Variables
โ Basic data types
โ Operators
โ Conditions
โ Loops
โ Basic debugging
๐ก Practice
1๏ธโฃ Print your name
2๏ธโฃ Calculate your age after 5 years
3๏ธโฃ Check whether a number is positive or negative
4๏ธโฃ Print numbers from 1 to 10
5๏ธโฃ Check whether a person is eligible to vote
๐ Double Tap โค๏ธ For Part-2
๐ฑ Programming Fundamentals
Before learning JavaScript syntax, it is important to understand what programming actually means.
1๏ธโฃ What is Programming?
Programming means giving a computer a set of instructions to perform a task.
For example:
console.log("Hello World");Here, you are telling JavaScript to display:
Hello World
Think of programming like giving instructions to a very literal assistant โ it does exactly what you tell it to do.
2๏ธโฃ What is JavaScript?
JavaScript is a programming language mainly used to make websites and applications interactive.
It can be used for:
๐น Websites
๐น Web applications
๐น Backend development
๐น Mobile applications
๐น Desktop applications
๐น APIs
๐น Automation
๐น AI-powered applications
3๏ธโฃ How JavaScript Works
When you write:
let name = "Rahul";
console.log(name);
JavaScript produces:
Rahul
JavaScript can run in different environments:
๐ Browser โ Chrome, Edge, Firefox, etc.
๐ข Node.js โ Server-side JavaScript
โก Other runtimes โ Modern JavaScript applications
4๏ธโฃ Variables
Variables are used to store values.
let age = 25;
const country = "India";
Here:
"age"
โ stores
"25"
/
"country"
โ stores
"India"
The two most important keywords:
let
const
let
can be reassigned.
const
cannot be reassigned.
5๏ธโฃ Basic Data Types
let name = "Rahul"; // String
let age = 25; // Number
let isStudent = true; // Boolean
let result; // Undefined
let value = null; // Null
Later, you'll learn:
๐น Objects
๐น Arrays
๐น Functions
๐น Symbols
๐น BigInt
6๏ธโฃ Operators
let a = 10;
let b = 5;
console.log(a + b); // 15
You'll eventually learn:
โ Arithmetic operators
๐ Comparison operators
๐ง Logical operators
๐ Assignment operators
โ Ternary operator
7๏ธโฃ Conditions
let age = 20;
if (age >= 18) {
console.log("You can vote");
}
8๏ธโฃ Loops
for (let i = 1; i <= 5; i++) {
console.log(i);
}Output:
1 2 3 4 5
Later you'll learn: ๐น for๐น while๐น do...while๐น for...of๐น for...in
9๏ธโฃ Debugging
You need to learn how to:
๐น Read error messages
๐น Find the problematic line
๐น Use
console.log()
๐น Use browser Developer Tools
๐น Use breakpoints
๐ง What You Should Know After Part 1
โ What programming means
โ What JavaScript is
โ Where JavaScript can run
โ Variables
โ Basic data types
โ Operators
โ Conditions
โ Loops
โ Basic debugging
๐ก Practice
1๏ธโฃ Print your name
2๏ธโฃ Calculate your age after 5 years
3๏ธโฃ Check whether a number is positive or negative
4๏ธโฃ Print numbers from 1 to 10
5๏ธโฃ Check whether a person is eligible to vote
๐ Double Tap โค๏ธ For Part-2
โค14
๐ ๐ง๐ผ๐ฝ ๐๐ป-๐๐ฒ๐บ๐ฎ๐ป๐ฑ ๐๐ฅ๐๐ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป๐ ๐๐ผ ๐ ๐ฎ๐๐๐ฒ๐ฟ ๐ถ๐ป ๐ฎ๐ฌ๐ฎ๐ฒ ๐ฅ
Explore these FREE certification courses in todayโs most in-demand technology fields:
๐ ๐๐ฎ๐๐ฎ ๐๐ป๐ฎ๐น๐๐๐ถ๐ฐ๐ :- https://pdlink.in/4eRA6eF
๐ป ๐ช๐ฒ๐ฏ ๐๐ฒ๐๐ฒ๐น๐ผ๐ฝ๐บ๐ฒ๐ป๐ :- https://pdlink.in/4gP18Eo
๐ซ ๐๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ถ๐ฎ๐น ๐๐ป๐๐ฒ๐น๐น๐ถ๐ด๐ฒ๐ป๐ฐ๐ฒ :- https://pdlink.in/45HWa5Q
โ๏ธ ๐๐น๐ผ๐๐ฑ ๐๐ผ๐บ๐ฝ๐๐๐ถ๐ป๐ด :- https://pdlink.in/4zrksPn
๐ง ๐๐ช๐ฆ :- https://pdlink.in/4j4Jxtv
๐ก๏ธ ๐๐๐ฏ๐ฒ๐ฟ๐๐ฒ๐ฐ๐๐ฟ๐ถ๐๐ & ๐๐๐๐ฟ๐ฒ :- https://pdlink.in/4f0GNuH
โก Start learning today and prepare yourself for better career opportunities in 2026!
Explore these FREE certification courses in todayโs most in-demand technology fields:
๐ ๐๐ฎ๐๐ฎ ๐๐ป๐ฎ๐น๐๐๐ถ๐ฐ๐ :- https://pdlink.in/4eRA6eF
๐ป ๐ช๐ฒ๐ฏ ๐๐ฒ๐๐ฒ๐น๐ผ๐ฝ๐บ๐ฒ๐ป๐ :- https://pdlink.in/4gP18Eo
๐ซ ๐๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ถ๐ฎ๐น ๐๐ป๐๐ฒ๐น๐น๐ถ๐ด๐ฒ๐ป๐ฐ๐ฒ :- https://pdlink.in/45HWa5Q
โ๏ธ ๐๐น๐ผ๐๐ฑ ๐๐ผ๐บ๐ฝ๐๐๐ถ๐ป๐ด :- https://pdlink.in/4zrksPn
๐ง ๐๐ช๐ฆ :- https://pdlink.in/4j4Jxtv
๐ก๏ธ ๐๐๐ฏ๐ฒ๐ฟ๐๐ฒ๐ฐ๐๐ฟ๐ถ๐๐ & ๐๐๐๐ฟ๐ฒ :- https://pdlink.in/4f0GNuH
โก Start learning today and prepare yourself for better career opportunities in 2026!
โค2
๐ป JavaScript Roadmap 2026 โ Part 2
๐ข JavaScript Fundamentals โ Variables, Data Types & Type Conversion
Now that you understand the basic idea of programming and JavaScript, let's learn how JavaScript stores and works with different kinds of data.
1๏ธโฃ Variables in JavaScript
A variable is a named container used to store a value.
Here:
โข "name" stores "Rahul"
โข "age" stores "25"
You can use the variable later:
Output:
2๏ธโฃ "let", "const" and "var"
JavaScript provides three keywords for declaring variables.
"let"
Use "let" when the value may change.
Output:
"const"
Use "const" when you don't intend to reassign the variable.
This will cause an error:
because a "const" variable cannot be reassigned.
"var"
"var" is the older way of declaring variables.
Modern JavaScript generally prefers:
โข
โข
over "var".
3๏ธโฃ Variable Naming Rules
Valid:
Invalid:
Variable names cannot start with a number.
Also avoid names like:
because "let" is a reserved JavaScript keyword.
A common naming style is camelCase:
4๏ธโฃ JavaScript Data Types
A data type tells JavaScript what kind of value it is dealing with.
JavaScript has several built-in data types.
The most important ones initially are:
๐น String
Used for text.
Strings can also use backticks:
๐น Number
Used for numbers.
JavaScript uses the "number" type for both integers and decimal numbers.
๐น Boolean
A Boolean has only two values:
โข true
โข false
Example:
Booleans are extremely important when working with conditions.
๐น Undefined
A variable that has been declared but hasn't been given a value contains "undefined".
Output:
๐น Null
"null" represents an intentional absence of a value.
This means you are deliberately saying:
"There is currently no selected user."
5๏ธโฃ Checking Data Types
JavaScript provides "typeof".
Output:
More examples:
One famous JavaScript quirk is:
This is a historical behavior in JavaScript.
6๏ธโฃ Primitive vs Reference Values
This distinction becomes very important later.
Primitive values include:
โข ๐น String
โข ๐น Number
โข ๐น Boolean
โข ๐น Undefined
โข ๐น Null
โข ๐น BigInt
โข ๐น Symbol
Objects, arrays, and functions are non-primitive/reference values.
For example:
"name" contains a primitive value.
"person" is an object.
You'll understand the difference much more deeply when we cover objects, memory, and references.
7๏ธโฃ Type Conversion
Sometimes you need to convert one data type into another.
For example:
๐ข JavaScript Fundamentals โ Variables, Data Types & Type Conversion
Now that you understand the basic idea of programming and JavaScript, let's learn how JavaScript stores and works with different kinds of data.
1๏ธโฃ Variables in JavaScript
A variable is a named container used to store a value.
let name = "Rahul";
let age = 25;
Here:
โข "name" stores "Rahul"
โข "age" stores "25"
You can use the variable later:
console.log(name);
console.log(age);
Output:
Rahul
25
2๏ธโฃ "let", "const" and "var"
JavaScript provides three keywords for declaring variables.
"let"
Use "let" when the value may change.
let score = 50;
score = 80;
console.log(score);
Output:
80
"const"
Use "const" when you don't intend to reassign the variable.
const country = "India";
console.log(country);
This will cause an error:
country = "Japan"; // Error: Assignment to constant variable.
because a "const" variable cannot be reassigned.
"var"
"var" is the older way of declaring variables.
var city = "Pune";
Modern JavaScript generally prefers:
โข
let
โข
const
over "var".
3๏ธโฃ Variable Naming Rules
Valid:
let firstName = "Rahul";
let age2 = 25;
let totalAmount = 5000;
Invalid:
let 2age = 25; // Error: Unexpected number
Variable names cannot start with a number.
Also avoid names like:
let let = 10; // Error: Unexpected token
because "let" is a reserved JavaScript keyword.
A common naming style is camelCase:
let firstName = "Rahul";
let totalMarks = 450;
let accountBalance = 50000;
4๏ธโฃ JavaScript Data Types
A data type tells JavaScript what kind of value it is dealing with.
JavaScript has several built-in data types.
The most important ones initially are:
๐น String
Used for text.
let name = "Rahul";
let message = 'Hello';
Strings can also use backticks:
let message = `Hello Rahul`;
๐น Number
Used for numbers.
let age = 25;
let price = 999.50;
JavaScript uses the "number" type for both integers and decimal numbers.
๐น Boolean
A Boolean has only two values:
โข true
โข false
Example:
let isLoggedIn = true;
let isAdmin = false;
Booleans are extremely important when working with conditions.
๐น Undefined
A variable that has been declared but hasn't been given a value contains "undefined".
let result;
console.log(result);
Output:
undefined
๐น Null
"null" represents an intentional absence of a value.
let selectedUser = null;
This means you are deliberately saying:
"There is currently no selected user."
5๏ธโฃ Checking Data Types
JavaScript provides "typeof".
let name = "Rahul";
console.log(typeof name);
Output:
string
More examples:
console.log(typeof 25); // Output: number
console.log(typeof true); // Output: boolean
console.log(typeof undefined); // Output: undefined
One famous JavaScript quirk is:
typeof null; // returns: object
This is a historical behavior in JavaScript.
6๏ธโฃ Primitive vs Reference Values
This distinction becomes very important later.
Primitive values include:
โข ๐น String
โข ๐น Number
โข ๐น Boolean
โข ๐น Undefined
โข ๐น Null
โข ๐น BigInt
โข ๐น Symbol
Objects, arrays, and functions are non-primitive/reference values.
For example:
let name = "Rahul";
let person = {
name: "Rahul",
age: 25
};
"name" contains a primitive value.
"person" is an object.
You'll understand the difference much more deeply when we cover objects, memory, and references.
7๏ธโฃ Type Conversion
Sometimes you need to convert one data type into another.
For example:
let age = "25"; // Here "age" is a string, not a number.
โค2
You can convert it:
Now:
25 is a number.
8๏ธโฃ Converting to String
Use "String()".
Output:
string
9๏ธโฃ Converting to Boolean
Use "Boolean()".
Some common falsy values are:
โข false
โข 0
โข ""
โข null
โข undefined
โข NaN
Most other values are truthy.
Understanding truthy and falsy values will become very useful when writing conditions.
๐ Type Coercion
JavaScript can sometimes automatically convert values between types.
For example:
Output:
``
Why?
Because
with a string causes the number to be converted into a string.
But:
Output:
``
JavaScript converts
into a number for the subtraction.
This behavior is called type coercion.
๐ Double Tap โค๏ธ For Part-3
let numberAge = Number(age);
console.log(numberAge);
Now:
25 is a number.
8๏ธโฃ Converting to String
Use "String()".
let age = 25;
let textAge = String(age);
console.log(typeof textAge);
Output:
string
9๏ธโฃ Converting to Boolean
Use "Boolean()".
console.log(Boolean(1)); // Output: true
console.log(Boolean(0)); // Output: false
Some common falsy values are:
โข false
โข 0
โข ""
โข null
โข undefined
โข NaN
Most other values are truthy.
Understanding truthy and falsy values will become very useful when writing conditions.
๐ Type Coercion
JavaScript can sometimes automatically convert values between types.
For example:
console.log("5" + 2);Output:
``
text
52``Why?
Because
+
with a string causes the number to be converted into a string.
But:
console.log("5" - 2);Output:
``
text
3``JavaScript converts
"5"
into a number for the subtraction.
This behavior is called type coercion.
๐ Double Tap โค๏ธ For Part-3
โค12๐ฅ2
๐ง๐ผ๐ฝ ๐ญ๐ฑ ๐ฃ๐๐๐ต๐ผ๐ป ๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐ค๐๐ฒ๐๐๐ถ๐ผ๐ป๐ ๐ฌ๐ผ๐ ๐ ๐จ๐ฆ๐ง ๐๐ป๐ผ๐! ๐ฅ
Preparing for a Python Developer or Data Analyst interview?
Strengthen your fundamentals with these essential interview topics.
๐ฏ Perfect for Students โข Freshers โข Python Learners โข Data Analyst Aspirants
๐ ๐๐ฒ๐ ๐๐ต๐ฒ ๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐ค๐๐ฒ๐๐๐ถ๐ผ๐ป๐ ๐
https://pdlink.in/3TAUwk7
๐Save this for your next interview and share it with a friend!
Preparing for a Python Developer or Data Analyst interview?
Strengthen your fundamentals with these essential interview topics.
๐ฏ Perfect for Students โข Freshers โข Python Learners โข Data Analyst Aspirants
๐ ๐๐ฒ๐ ๐๐ต๐ฒ ๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐ค๐๐ฒ๐๐๐ถ๐ผ๐ป๐ ๐
https://pdlink.in/3TAUwk7
๐Save this for your next interview and share it with a friend!
๐ป JavaScript Roadmap 2026 โ Part 3
๐ข JavaScript Operators & Expressions
Operators are symbols or keywords that tell JavaScript to perform an operation.
For example:
let a = 10;
let b = 5;
console.log(a + b);
Here, "+" is an operator.
1๏ธโฃ Arithmetic Operators
Arithmetic operators are used for mathematical calculations.
Addition "+"
let a = 10;
let b = 5;
console.log(a + b);
Output:
15
Subtraction "-"
console.log(a - b);
Output:
5
Multiplication *
console.log(a * b);
Output:
50
Division "/"
console.log(a / b);
Output:
2
Remainder "%"
Returns the remainder after division.
console.log(10 % 3);
Output:
1
This is particularly useful for checking whether a number is even or odd.
let number = 10;
console.log(number % 2 === 0);
Output:
true
Exponentiation **
Used for powers.
console.log(2 ** 3);
Output:
8
2๏ธโฃ Assignment Operators
Assignment operators assign values to variables.
Basic assignment
let score = 100;
"=" means "assign this value."
It does not mean mathematical equality.
Addition assignment
let score = 100;
score += 20;
console.log(score);
Output:
120
This is equivalent to:
score = score + 20;
Similarly:
score -= 10;
score *= 2;
score /= 5;
score %= 3;
These are called compound assignment operators.
3๏ธโฃ Increment and Decrement
Increment "++"
let count = 5;
count++;
console.log(count);
Output:
6
Decrement "--"
let count = 5;
count--;
console.log(count);
Output:
4
You'll frequently see these inside loops.
4๏ธโฃ Comparison Operators
Comparison operators compare values and return either:
true
or
false
Greater than ">"
console.log(10 > 5);
Output:
true
Less than "<"
console.log(10 < 5);
Output:
false
Greater than or equal ">="
console.log(10 >= 10);
Output:
true
Less than or equal "<="
console.log(5 <= 10);
Output:
true
5๏ธโฃ Equality Operators
Loose equality "=="
console.log(5 == "5");
Output:
true
JavaScript performs type conversion before comparing.
Strict equality "==="
console.log(5 === "5");
Output:
false
The values look similar, but their types are different:
5 โ number
"5" โ string
Strict inequality "!=="
console.log(5 !== "5");
Output:
true
Best practice
For normal JavaScript development, prefer:
===
!==
over:
==
!=
because strict comparison avoids unexpected type conversion.
6๏ธโฃ Logical Operators
Logical operators are extremely important when creating conditions.
AND "&&"
Returns true when both conditions are true.
let age = 25;
let hasID = true;
console.log(age >= 18 && hasID);
Output:
true
Both conditions must be true.
Example:
Age โฅ 18 โ true
Has ID โ true
Result โ true
If either condition is false, the overall result is false.
OR "||"
Returns true when at least one condition is true.
let hasEmail = false;
let hasPhone = true;
console.log(hasEmail || hasPhone);
Output:
true
Because one condition is true.
NOT "!"
Reverses a Boolean value.
console.log(!true);
Output:
false
And:
console.log(!false);
Output:
true
Example:
let isLoggedIn = false;
if (!isLoggedIn) {
console.log("Please log in");
}
๐ข JavaScript Operators & Expressions
Operators are symbols or keywords that tell JavaScript to perform an operation.
For example:
let a = 10;
let b = 5;
console.log(a + b);
Here, "+" is an operator.
1๏ธโฃ Arithmetic Operators
Arithmetic operators are used for mathematical calculations.
Addition "+"
let a = 10;
let b = 5;
console.log(a + b);
Output:
15
Subtraction "-"
console.log(a - b);
Output:
5
Multiplication *
console.log(a * b);
Output:
50
Division "/"
console.log(a / b);
Output:
2
Remainder "%"
Returns the remainder after division.
console.log(10 % 3);
Output:
1
This is particularly useful for checking whether a number is even or odd.
let number = 10;
console.log(number % 2 === 0);
Output:
true
Exponentiation **
Used for powers.
console.log(2 ** 3);
Output:
8
2๏ธโฃ Assignment Operators
Assignment operators assign values to variables.
Basic assignment
let score = 100;
"=" means "assign this value."
It does not mean mathematical equality.
Addition assignment
let score = 100;
score += 20;
console.log(score);
Output:
120
This is equivalent to:
score = score + 20;
Similarly:
score -= 10;
score *= 2;
score /= 5;
score %= 3;
These are called compound assignment operators.
3๏ธโฃ Increment and Decrement
Increment "++"
let count = 5;
count++;
console.log(count);
Output:
6
Decrement "--"
let count = 5;
count--;
console.log(count);
Output:
4
You'll frequently see these inside loops.
4๏ธโฃ Comparison Operators
Comparison operators compare values and return either:
true
or
false
Greater than ">"
console.log(10 > 5);
Output:
true
Less than "<"
console.log(10 < 5);
Output:
false
Greater than or equal ">="
console.log(10 >= 10);
Output:
true
Less than or equal "<="
console.log(5 <= 10);
Output:
true
5๏ธโฃ Equality Operators
Loose equality "=="
console.log(5 == "5");
Output:
true
JavaScript performs type conversion before comparing.
Strict equality "==="
console.log(5 === "5");
Output:
false
The values look similar, but their types are different:
5 โ number
"5" โ string
Strict inequality "!=="
console.log(5 !== "5");
Output:
true
Best practice
For normal JavaScript development, prefer:
===
!==
over:
==
!=
because strict comparison avoids unexpected type conversion.
6๏ธโฃ Logical Operators
Logical operators are extremely important when creating conditions.
AND "&&"
Returns true when both conditions are true.
let age = 25;
let hasID = true;
console.log(age >= 18 && hasID);
Output:
true
Both conditions must be true.
Example:
Age โฅ 18 โ true
Has ID โ true
Result โ true
If either condition is false, the overall result is false.
OR "||"
Returns true when at least one condition is true.
let hasEmail = false;
let hasPhone = true;
console.log(hasEmail || hasPhone);
Output:
true
Because one condition is true.
NOT "!"
Reverses a Boolean value.
console.log(!true);
Output:
false
And:
console.log(!false);
Output:
true
Example:
let isLoggedIn = false;
if (!isLoggedIn) {
console.log("Please log in");
}
โค1
7๏ธโฃ Ternary Operator
The ternary operator is a short way to write a simple "if...else".
Instead of:
let age = 20;
let message;
if (age >= 18) {
message = "Adult";
} else {
message = "Minor";
}
You can write:
let age = 20;
let message = age >= 18 ? "Adult" : "Minor";
console.log(message);
Output:
Adult
The structure is:
condition ? valueIfTrue : valueIfFalse
Use it for simple decisions. For complicated logic, a normal "if...else" is usually easier to read.
8๏ธโฃ Nullish Coalescing "??"
This operator is useful when you want a fallback only when a value is "null" or "undefined".
let username = null;
let name = username ?? "Guest";
console.log(name);
Output:
Guest
Compare this with "||":
let score = 0;
console.log(score || 100);
Output:
100
But:
console.log(score ?? 100);
Output:
0
Why?
Because "0" is falsy, but it is not "null" or "undefined".
This distinction becomes very useful when working with real-world data.
9๏ธโฃ Optional Chaining "?."
Optional chaining allows you to safely access properties that may not exist.
Without optional chaining:
let user = {};
console.log(user.address.city);
This can cause an error because "address" doesn't exist.
With optional chaining:
let user = {};
console.log(user.address?.city);
Result:
undefined
Instead of immediately throwing an error.
You'll use this frequently when working with API responses and nested objects.
๐ Operator Precedence
JavaScript doesn't simply evaluate everything from left to right.
For example:
let result = 10 + 5 * 2;
console.log(result);
Output:
20
Multiplication happens before addition.
You can use parentheses to make the intended order clear:
let result = (10 + 5) * 2;
console.log(result);
Output:
30
When in doubt, use parentheses rather than relying on complicated precedence rules.
1๏ธโฃ1๏ธโฃ Expressions
An expression is something that produces a value.
Examples:
10 + 5
produces:
15
Another example:
age >= 18
produces either:
true
or:
false
And:
name ?? "Guest"
produces a value.
Expressions are the building blocks of JavaScript programs.
๐ง Real-World Example
Imagine an online shopping application.
let price = 2000;
let discount = 500;
let isMember = true;
let finalPrice = price - discount;
if (isMember && finalPrice > 1000) {
console.log("Member discount applied");
}
Here you're using:
โข Variables
โข Arithmetic operators
โข Comparison operators
โข Logical operators
โข Conditions
This is how basic JavaScript concepts start working together in real applications.
๐ Double Tap โค๏ธ For Part-4
The ternary operator is a short way to write a simple "if...else".
Instead of:
let age = 20;
let message;
if (age >= 18) {
message = "Adult";
} else {
message = "Minor";
}
You can write:
let age = 20;
let message = age >= 18 ? "Adult" : "Minor";
console.log(message);
Output:
Adult
The structure is:
condition ? valueIfTrue : valueIfFalse
Use it for simple decisions. For complicated logic, a normal "if...else" is usually easier to read.
8๏ธโฃ Nullish Coalescing "??"
This operator is useful when you want a fallback only when a value is "null" or "undefined".
let username = null;
let name = username ?? "Guest";
console.log(name);
Output:
Guest
Compare this with "||":
let score = 0;
console.log(score || 100);
Output:
100
But:
console.log(score ?? 100);
Output:
0
Why?
Because "0" is falsy, but it is not "null" or "undefined".
This distinction becomes very useful when working with real-world data.
9๏ธโฃ Optional Chaining "?."
Optional chaining allows you to safely access properties that may not exist.
Without optional chaining:
let user = {};
console.log(user.address.city);
This can cause an error because "address" doesn't exist.
With optional chaining:
let user = {};
console.log(user.address?.city);
Result:
undefined
Instead of immediately throwing an error.
You'll use this frequently when working with API responses and nested objects.
๐ Operator Precedence
JavaScript doesn't simply evaluate everything from left to right.
For example:
let result = 10 + 5 * 2;
console.log(result);
Output:
20
Multiplication happens before addition.
You can use parentheses to make the intended order clear:
let result = (10 + 5) * 2;
console.log(result);
Output:
30
When in doubt, use parentheses rather than relying on complicated precedence rules.
1๏ธโฃ1๏ธโฃ Expressions
An expression is something that produces a value.
Examples:
10 + 5
produces:
15
Another example:
age >= 18
produces either:
true
or:
false
And:
name ?? "Guest"
produces a value.
Expressions are the building blocks of JavaScript programs.
๐ง Real-World Example
Imagine an online shopping application.
let price = 2000;
let discount = 500;
let isMember = true;
let finalPrice = price - discount;
if (isMember && finalPrice > 1000) {
console.log("Member discount applied");
}
Here you're using:
โข Variables
โข Arithmetic operators
โข Comparison operators
โข Logical operators
โข Conditions
This is how basic JavaScript concepts start working together in real applications.
๐ Double Tap โค๏ธ For Part-4
โค4
๐๐ป๐ณ๐ผ๐๐๐ ๐ ๐ผ๐๐ ๐๐๐ธ๐ฒ๐ฑ ๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐ค๐๐ฒ๐๐๐ถ๐ผ๐ป๐ & ๐๐ป๐๐๐ฒ๐ฟ๐๐
โ
โ Real Interview Experiences
โ Company-specific Handbook
โ Interview Process & Preparation Roadmap
โ FREE Preparation Resources
โ
Specialist Programmer :- https://pdlink.in/4xDH2lD
โ
โ Systems Engineer :- https://pdlink.in/4xAhGoL
โ
โInfosys Digital Specialist Engineer :- https://pdlink.in/4yJ98gb
โ
โThe best way to prepare is to learn from candidates who've already been through the process.
โ
โ
โ Real Interview Experiences
โ Company-specific Handbook
โ Interview Process & Preparation Roadmap
โ FREE Preparation Resources
โ
Specialist Programmer :- https://pdlink.in/4xDH2lD
โ
โ Systems Engineer :- https://pdlink.in/4xAhGoL
โ
โInfosys Digital Specialist Engineer :- https://pdlink.in/4yJ98gb
โ
โThe best way to prepare is to learn from candidates who've already been through the process.
โ
๐ป JavaScript Roadmap 2026 โ Part 4
๐ข Conditional Statements & Loops
Programs often need to make decisions and repeat tasks.
For example:
โข If a user is logged in โ show the dashboard.
โข If the payment fails โ show an error.
โข Repeat a task for every item in a list.
โข Continue processing until a condition becomes false.
JavaScript provides conditional statements and loops for this.
1๏ธโฃ "if" Statement
The "if" statement executes code only when a condition is "true".
let age = 20;
if (age >= 18) {
console.log("You are an adult");
}
Since "age >= 18" is "true", the message is printed.
Basic structure
if (condition) {
// code to execute
}
2๏ธโฃ "if...else"
Use "else" when you want to execute another block if the condition is false.
let age = 16;
if (age >= 18) {
console.log("You can vote");
} else {
console.log("You cannot vote");
}
Output: You cannot vote
3๏ธโฃ "else if"
Sometimes there are multiple conditions.
let marks = 75;
if (marks >= 90) {
console.log("Grade A+");
} else if (marks >= 75) {
console.log("Grade A");
} else if (marks >= 60) {
console.log("Grade B");
} else {
console.log("Grade C");
}
Output: Grade A
JavaScript checks the conditions from top to bottom. Once it finds a true condition, the remaining "else if" blocks are skipped.
4๏ธโฃ Multiple Conditions
You can combine conditions using logical operators.
let age = 25;
let hasID = true;
if (age >= 18 && hasID) {
console.log("Access granted");
}
Both conditions must be true because we used "&&".
Using OR
let hasEmail = false;
let hasPhone = true;
if (hasEmail || hasPhone) {
console.log("Contact information available");
}
At least one condition needs to be true.
5๏ธโฃ Nested "if"
An "if" statement can exist inside another "if".
let isLoggedIn = true;
let isAdmin = true;
if (isLoggedIn) {
if (isAdmin) {
console.log("Admin dashboard");
}
}
Nested conditions can be useful, but too much nesting can make code difficult to read. When logic becomes complicated, consider restructuring the conditions.
๐น "switch" Statement
6๏ธโฃ What is "switch"?
"switch" is useful when you want to compare one value against several possible values.
let day = "Monday";
switch (day) {
case "Monday":
console.log("Start of the week");
break;
case "Friday":
console.log("Almost weekend");
break;
default:
console.log("Regular day");
}
Output: Start of the week
7๏ธโฃ Why "break" Matters
let number = 2;
switch (number) {
case 1:
console.log("One");
break;
case 2:
console.log("Two");
break;
case 3:
console.log("Three");
break;
}
"break" tells JavaScript to exit the "switch". Without it, execution can continue into subsequent cases. This behavior is called fall-through.
8๏ธโฃ "default"
"default" runs when none of the cases match.
let fruit = "Mango";
switch (fruit) {
case "Apple":
console.log("Apple");
break;
case "Banana":
console.log("Banana");
break;
default:
console.log("Unknown fruit");
}
Output: Unknown fruit
๐ LOOPS
Loops allow you to execute code repeatedly.
Instead of writing:
console.log(1);
console.log(2);
console.log(3);
you can use a loop.
9๏ธโฃ "for" Loop
The traditional "for" loop has three parts:
for (initialization; condition; update) {
// code
}
Example:
for (let i = 1; i <= 5; i++) {
console.log(i);
}
Output: 1 2 3 4 5
Let's break it down:
โข let i = 1 โ Start with 1.
โข i <= 5 โ Continue while "i" is less than or equal to 5.
โข i++ โ Increase "i" after every iteration.
๐ Understanding an Iteration
For:
for (let i = 1; i <= 3; i++) {
console.log(i);
}
JavaScript roughly follows:
โข i = 1 โ condition true โ print 1
โข i = 2 โ condition true โ print 2
โข i = 3 โ condition true โ print 3
โข i = 4 โ condition false โ stop
Understanding this process is more important than memorizing the syntax.
๐ข Conditional Statements & Loops
Programs often need to make decisions and repeat tasks.
For example:
โข If a user is logged in โ show the dashboard.
โข If the payment fails โ show an error.
โข Repeat a task for every item in a list.
โข Continue processing until a condition becomes false.
JavaScript provides conditional statements and loops for this.
1๏ธโฃ "if" Statement
The "if" statement executes code only when a condition is "true".
let age = 20;
if (age >= 18) {
console.log("You are an adult");
}
Since "age >= 18" is "true", the message is printed.
Basic structure
if (condition) {
// code to execute
}
2๏ธโฃ "if...else"
Use "else" when you want to execute another block if the condition is false.
let age = 16;
if (age >= 18) {
console.log("You can vote");
} else {
console.log("You cannot vote");
}
Output: You cannot vote
3๏ธโฃ "else if"
Sometimes there are multiple conditions.
let marks = 75;
if (marks >= 90) {
console.log("Grade A+");
} else if (marks >= 75) {
console.log("Grade A");
} else if (marks >= 60) {
console.log("Grade B");
} else {
console.log("Grade C");
}
Output: Grade A
JavaScript checks the conditions from top to bottom. Once it finds a true condition, the remaining "else if" blocks are skipped.
4๏ธโฃ Multiple Conditions
You can combine conditions using logical operators.
let age = 25;
let hasID = true;
if (age >= 18 && hasID) {
console.log("Access granted");
}
Both conditions must be true because we used "&&".
Using OR
let hasEmail = false;
let hasPhone = true;
if (hasEmail || hasPhone) {
console.log("Contact information available");
}
At least one condition needs to be true.
5๏ธโฃ Nested "if"
An "if" statement can exist inside another "if".
let isLoggedIn = true;
let isAdmin = true;
if (isLoggedIn) {
if (isAdmin) {
console.log("Admin dashboard");
}
}
Nested conditions can be useful, but too much nesting can make code difficult to read. When logic becomes complicated, consider restructuring the conditions.
๐น "switch" Statement
6๏ธโฃ What is "switch"?
"switch" is useful when you want to compare one value against several possible values.
let day = "Monday";
switch (day) {
case "Monday":
console.log("Start of the week");
break;
case "Friday":
console.log("Almost weekend");
break;
default:
console.log("Regular day");
}
Output: Start of the week
7๏ธโฃ Why "break" Matters
let number = 2;
switch (number) {
case 1:
console.log("One");
break;
case 2:
console.log("Two");
break;
case 3:
console.log("Three");
break;
}
"break" tells JavaScript to exit the "switch". Without it, execution can continue into subsequent cases. This behavior is called fall-through.
8๏ธโฃ "default"
"default" runs when none of the cases match.
let fruit = "Mango";
switch (fruit) {
case "Apple":
console.log("Apple");
break;
case "Banana":
console.log("Banana");
break;
default:
console.log("Unknown fruit");
}
Output: Unknown fruit
๐ LOOPS
Loops allow you to execute code repeatedly.
Instead of writing:
console.log(1);
console.log(2);
console.log(3);
you can use a loop.
9๏ธโฃ "for" Loop
The traditional "for" loop has three parts:
for (initialization; condition; update) {
// code
}
Example:
for (let i = 1; i <= 5; i++) {
console.log(i);
}
Output: 1 2 3 4 5
Let's break it down:
โข let i = 1 โ Start with 1.
โข i <= 5 โ Continue while "i" is less than or equal to 5.
โข i++ โ Increase "i" after every iteration.
๐ Understanding an Iteration
For:
for (let i = 1; i <= 3; i++) {
console.log(i);
}
JavaScript roughly follows:
โข i = 1 โ condition true โ print 1
โข i = 2 โ condition true โ print 2
โข i = 3 โ condition true โ print 3
โข i = 4 โ condition false โ stop
Understanding this process is more important than memorizing the syntax.
โค1
1๏ธโฃ1๏ธโฃ "while" Loop
A "while" loop runs as long as its condition remains true.
let count = 1;
while (count <= 5) {
console.log(count);
count++;
}
Output: 1 2 3 4 5
Be careful to update the variable. This can create an infinite loop:
let count = 1;
while (count <= 5) {
console.log(count);
}
"count" never changes, so the condition never becomes false.
1๏ธโฃ2๏ธโฃ "do...while"
A "do...while" loop executes the code at least once, because the condition is checked after the code runs.
let count = 10;
do {
console.log(count);
count++;
} while (count < 5);
Output: 10
Even though "count < 5" is false, the code runs once.
Compare:
while (count < 5) {
console.log(count);
}
The "while" loop may execute zero times.
1๏ธโฃ3๏ธโฃ "break"
"break" immediately stops a loop.
for (let i = 1; i <= 10; i++) {
if (i === 5) {
break;
}
console.log(i);
}
Output: 1 2 3 4
1๏ธโฃ4๏ธโฃ "continue"
"continue" skips the current iteration and moves to the next one.
for (let i = 1; i <= 5; i++) {
if (i === 3) {
continue;
}
console.log(i);
}
Output: 1 2 4 5
1๏ธโฃ5๏ธโฃ Nested Loops
You can put one loop inside another.
for (let i = 1; i <= 3; i++) {
for (let j = 1; j <= 2; j++) {
console.log(i, j);
}
}
Output:
โข 1 1
โข 1 2
โข 2 1
โข 2 2
โข 3 1
โข 3 2
Nested loops are useful for:
โข Grids
โข Tables
โข Matrices
โข Combinations
โข Certain algorithmic problems
But they can become expensive when working with large datasets.
โญ 1๏ธโฃ6๏ธโฃ "for...of"
"for...of" is especially useful for iterating over values in an iterable such as an array or string.
let fruits = ["Apple", "Banana", "Mango"];
for (let fruit of fruits) {
console.log(fruit);
}
Output: Apple Banana Mango
โญ 1๏ธโฃ7๏ธโฃ "for...in"
"for...in" is commonly used to iterate over enumerable property keys of an object.
let person = {
name: "Rahul",
age: 25,
city: "Pune"
};
for (let key in person) {
console.log(key);
}
Output: name age city
To access the corresponding value:
for (let key in person) {
console.log(key, person[key]);
}
Output: name Rahul, age 25, city Pune
Important distinction
โข for...of โ values
โข for...in โ property keys
๐ง Real-World Example
Imagine an e-commerce application. You want to check whether each customer has completed their payment.
let payments = [
"success",
"success",
"failed",
"success"
];
for (let payment of payments) {
if (payment === "success") {
console.log("Order confirmed");
} else {
console.log("Payment failed");
}
}
Output: Order confirmed, Order confirmed, Payment failed, Order confirmed
๐ป Practice
1๏ธโฃ Voting eligibility
Write a program that prints Eligible when age is 18 or above, otherwise Not eligible
2๏ธโฃ Even numbers
Use a loop to print: 2 4 6 8 10
3๏ธโฃ Multiplication table
Print the multiplication table of 7
4๏ธโฃ Find a number
Loop from 1 to 20 and stop when you reach 13. Use "break".
5๏ธโฃ Skip numbers
Loop from 1 to 10 but skip 5. Use "continue".
6๏ธโฃ Predict the output
for (let i = 1; i <= 5; i++) {
if (i === 3) {
continue;
}
console.log(i);
}
7๏ธโฃ Challenge
Write a program that checks numbers from 1 to 20 and prints Even for even numbers and Odd for odd numbers.
Hint: number % 2 === 0
๐ง Double Tap โค๏ธ For More
A "while" loop runs as long as its condition remains true.
let count = 1;
while (count <= 5) {
console.log(count);
count++;
}
Output: 1 2 3 4 5
Be careful to update the variable. This can create an infinite loop:
let count = 1;
while (count <= 5) {
console.log(count);
}
"count" never changes, so the condition never becomes false.
1๏ธโฃ2๏ธโฃ "do...while"
A "do...while" loop executes the code at least once, because the condition is checked after the code runs.
let count = 10;
do {
console.log(count);
count++;
} while (count < 5);
Output: 10
Even though "count < 5" is false, the code runs once.
Compare:
while (count < 5) {
console.log(count);
}
The "while" loop may execute zero times.
1๏ธโฃ3๏ธโฃ "break"
"break" immediately stops a loop.
for (let i = 1; i <= 10; i++) {
if (i === 5) {
break;
}
console.log(i);
}
Output: 1 2 3 4
1๏ธโฃ4๏ธโฃ "continue"
"continue" skips the current iteration and moves to the next one.
for (let i = 1; i <= 5; i++) {
if (i === 3) {
continue;
}
console.log(i);
}
Output: 1 2 4 5
1๏ธโฃ5๏ธโฃ Nested Loops
You can put one loop inside another.
for (let i = 1; i <= 3; i++) {
for (let j = 1; j <= 2; j++) {
console.log(i, j);
}
}
Output:
โข 1 1
โข 1 2
โข 2 1
โข 2 2
โข 3 1
โข 3 2
Nested loops are useful for:
โข Grids
โข Tables
โข Matrices
โข Combinations
โข Certain algorithmic problems
But they can become expensive when working with large datasets.
โญ 1๏ธโฃ6๏ธโฃ "for...of"
"for...of" is especially useful for iterating over values in an iterable such as an array or string.
let fruits = ["Apple", "Banana", "Mango"];
for (let fruit of fruits) {
console.log(fruit);
}
Output: Apple Banana Mango
โญ 1๏ธโฃ7๏ธโฃ "for...in"
"for...in" is commonly used to iterate over enumerable property keys of an object.
let person = {
name: "Rahul",
age: 25,
city: "Pune"
};
for (let key in person) {
console.log(key);
}
Output: name age city
To access the corresponding value:
for (let key in person) {
console.log(key, person[key]);
}
Output: name Rahul, age 25, city Pune
Important distinction
โข for...of โ values
โข for...in โ property keys
๐ง Real-World Example
Imagine an e-commerce application. You want to check whether each customer has completed their payment.
let payments = [
"success",
"success",
"failed",
"success"
];
for (let payment of payments) {
if (payment === "success") {
console.log("Order confirmed");
} else {
console.log("Payment failed");
}
}
Output: Order confirmed, Order confirmed, Payment failed, Order confirmed
๐ป Practice
1๏ธโฃ Voting eligibility
Write a program that prints Eligible when age is 18 or above, otherwise Not eligible
2๏ธโฃ Even numbers
Use a loop to print: 2 4 6 8 10
3๏ธโฃ Multiplication table
Print the multiplication table of 7
4๏ธโฃ Find a number
Loop from 1 to 20 and stop when you reach 13. Use "break".
5๏ธโฃ Skip numbers
Loop from 1 to 10 but skip 5. Use "continue".
6๏ธโฃ Predict the output
for (let i = 1; i <= 5; i++) {
if (i === 3) {
continue;
}
console.log(i);
}
7๏ธโฃ Challenge
Write a program that checks numbers from 1 to 20 and prints Even for even numbers and Odd for odd numbers.
Hint: number % 2 === 0
๐ง Double Tap โค๏ธ For More
โค9
๐ ๐
๐๐๐ ๐๐๐ ๐๐๐ซ๐ญ๐ข๐๐ข๐๐๐ญ๐ข๐จ๐ง ๐๐จ๐ฎ๐ซ๐ฌ๐๐ฌ ๐
Explore these beginner-friendly courses and strengthen your resume!
๐ฏ Perfect for Students, Freshers and Working Professionals
๐ป Learn Online at Your Own Pace
๐ Earn Certificates After Successful Completion
๐ ๐๐ป๐ฟ๐ผ๐น๐น ๐ณ๐ผ๐ฟ ๐๐ฅ๐๐ ๐:-
https://pdlink.in/45KgqDR
๐ฅ Donโt just collect certificatesโbuild skills that employers value. Share this with your friends!
Explore these beginner-friendly courses and strengthen your resume!
๐ฏ Perfect for Students, Freshers and Working Professionals
๐ป Learn Online at Your Own Pace
๐ Earn Certificates After Successful Completion
๐ ๐๐ป๐ฟ๐ผ๐น๐น ๐ณ๐ผ๐ฟ ๐๐ฅ๐๐ ๐:-
https://pdlink.in/45KgqDR
๐ฅ Donโt just collect certificatesโbuild skills that employers value. Share this with your friends!
โค1
๐ป JavaScript Roadmap 2026 โ Part 5
๐ข Functions in JavaScript
Functions are one of the most important concepts in JavaScript.
A function is a reusable block of code designed to perform a particular task. Instead of writing the same code repeatedly, you can put it inside a function and call it whenever you need it.
1๏ธโฃ Creating a Function
The basic syntax is:
This creates a function called "greet". But creating a function doesn't execute it.
To execute it, you need to call it:
Output: Hello!
2๏ธโฃ Why Do We Need Functions?
Imagine you need to print the same message three times.
Without a function:
With a function:
Functions make code:
โ Reusable,
โ Easier to maintain,
โ Easier to test,
โ Easier to understand
3๏ธโฃ Function Parameters
Functions can accept information through parameters.
Output: Hello Rahul, Hello Priya
Here: name โ parameter, "Rahul" โ argument.
A parameter is the variable defined in the function. An argument is the actual value passed when calling it.
4๏ธโฃ Multiple Parameters
A function can accept multiple parameters.
You can reuse the same function:
5๏ธโฃ Returning a Value
A function doesn't always need to print something. It can return a value.
The important difference is:
6๏ธโฃ Understanding "return"
The process is: multiply(5, 4) โ 5 ร 4 โ 20 โ return 20 โ result = 20
Once JavaScript executes "return", the function stops executing.
7๏ธโฃ Functions Without "return"
That's completely valid. If a function doesn't explicitly return a value, its return value is: undefined
8๏ธโฃ Storing a Function in a Variable
Functions can be assigned to variables.
This is called a function expression.
Compare:
Function declaration:
Function expression:
Both can be called as functions, but they have different hoisting behavior.
๐น Arrow Functions
9๏ธโฃ What Is an Arrow Function?
Arrow functions provide a shorter syntax for writing functions.
Traditional function:
Arrow function:
๐ข Functions in JavaScript
Functions are one of the most important concepts in JavaScript.
A function is a reusable block of code designed to perform a particular task. Instead of writing the same code repeatedly, you can put it inside a function and call it whenever you need it.
1๏ธโฃ Creating a Function
The basic syntax is:
function greet() {
console.log("Hello!");
}This creates a function called "greet". But creating a function doesn't execute it.
To execute it, you need to call it:
greet();
Output: Hello!
2๏ธโฃ Why Do We Need Functions?
Imagine you need to print the same message three times.
Without a function:
console.log("Welcome to JavaScript");
console.log("Welcome to JavaScript");With a function:
function welcome() {
console.log("Welcome to JavaScript");
}
welcome();
welcome();
welcome();Functions make code:
โ Reusable,
โ Easier to maintain,
โ Easier to test,
โ Easier to understand
3๏ธโฃ Function Parameters
Functions can accept information through parameters.
function greet(name) {
console.log("Hello " + name);
}
greet("Rahul");
greet("Priya");Output: Hello Rahul, Hello Priya
Here: name โ parameter, "Rahul" โ argument.
A parameter is the variable defined in the function. An argument is the actual value passed when calling it.
4๏ธโฃ Multiple Parameters
A function can accept multiple parameters.
function add(a, b) {
console.log(a + b);
}
add(10, 5); // 15You can reuse the same function:
add(20, 30); add(100, 50);5๏ธโฃ Returning a Value
A function doesn't always need to print something. It can return a value.
function add(a, b) {
return a + b;
}
let result = add(10, 5);
console.log(result); // 15The important difference is:
console.log() displays something. return sends a value back from the function.6๏ธโฃ Understanding "return"
function multiply(a, b) {
return a * b;
}
let result = multiply(5, 4);
console.log(result);The process is: multiply(5, 4) โ 5 ร 4 โ 20 โ return 20 โ result = 20
Once JavaScript executes "return", the function stops executing.
function test() {
return "Hello";
console.log("This will not run");
}7๏ธโฃ Functions Without "return"
function greet(name) {
console.log("Hello " + name);
}
greet("Rahul");That's completely valid. If a function doesn't explicitly return a value, its return value is: undefined
function greet() {
console.log("Hello");
}
let result = greet();
console.log(result); // Hello, undefined8๏ธโฃ Storing a Function in a Variable
Functions can be assigned to variables.
const greet = function () {
console.log("Hello");
};
greet();This is called a function expression.
Compare:
Function declaration:
function greet() { console.log("Hello"); }Function expression:
const greet = function () { console.log("Hello"); };Both can be called as functions, but they have different hoisting behavior.
๐น Arrow Functions
9๏ธโฃ What Is an Arrow Function?
Arrow functions provide a shorter syntax for writing functions.
Traditional function:
function add(a, b) {
return a + b;
}Arrow function:
const add = (a, b) => {
return a + b;
};โค3
For a simple expression, you can make it even shorter:
This is called an implicit return.
๐ Arrow Function Examples
One parameter:
Multiple parameters:
No parameters:
1๏ธโฃ1๏ธโฃ Default Parameters
You can provide a default value for a parameter.
Default parameters are very useful when a value is optional.
1๏ธโฃ2๏ธโฃ Rest Parameters
Sometimes you don't know how many arguments will be passed.
You can use "...".
The rest parameter collects the arguments into an array.
1๏ธโฃ3๏ธโฃ Scope
Scope determines where a variable can be accessed.
"message" exists inside the function. Trying to access it outside:
This is because "message" has function/local scope.
1๏ธโฃ4๏ธโฃ Block Scope
Variables declared with "let" and "const" are block-scoped.
This works. But:
This is one reason "let" and "const" are preferred over "var".
1๏ธโฃ5๏ธโฃ Global Scope
A variable declared outside functions or blocks can be accessible from broader parts of the program.
However, don't create unnecessary global variables. Too many globals can make larger applications difficult to maintain.
โญ 1๏ธโฃ6๏ธโฃ Callback Functions
A function can be passed to another function.
Here:
โญ 1๏ธโฃ7๏ธโฃ Higher-Order Functions
A higher-order function is a function that: accepts another function as an argument, or returns a function.
Here "calculate()" receives another function. That's a higher-order function.
โญ 1๏ธโฃ8๏ธโฃ Functions Returning Functions
A function can also return another function.
const add = (a, b) => a + b;
This is called an implicit return.
๐ Arrow Function Examples
One parameter:
const square = number => number * number;
console.log(square(5)); // 25
Multiple parameters:
const multiply = (a, b) => a * b;
console.log(multiply(4, 5)); // 20
No parameters:
const greet = () => {
console.log("Hello");
};
greet();1๏ธโฃ1๏ธโฃ Default Parameters
You can provide a default value for a parameter.
function greet(name = "Guest") {
console.log("Hello " + name);
}
greet("Rahul"); // Hello Rahul
greet(); // Hello GuestDefault parameters are very useful when a value is optional.
1๏ธโฃ2๏ธโฃ Rest Parameters
Sometimes you don't know how many arguments will be passed.
You can use "...".
function add(...numbers) {
console.log(numbers);
}
add(10, 20, 30, 40); // [10, 20, 30, 40]The rest parameter collects the arguments into an array.
function add(...numbers) {
let total = 0;
for (let number of numbers) {
total += number;
}
return total;
}
console.log(add(10, 20, 30)); // 601๏ธโฃ3๏ธโฃ Scope
Scope determines where a variable can be accessed.
function greet() {
let message = "Hello";
console.log(message);
}
greet();"message" exists inside the function. Trying to access it outside:
console.log(message); will cause an error. This is because "message" has function/local scope.
1๏ธโฃ4๏ธโฃ Block Scope
Variables declared with "let" and "const" are block-scoped.
if (true) {
let message = "Hello";
console.log(message);
}This works. But:
console.log(message); outside the block does not. The block is defined by { // block }. This is one reason "let" and "const" are preferred over "var".
1๏ธโฃ5๏ธโฃ Global Scope
A variable declared outside functions or blocks can be accessible from broader parts of the program.
const appName = "My App";
function showAppName() {
console.log(appName);
}
showAppName(); // My App
However, don't create unnecessary global variables. Too many globals can make larger applications difficult to maintain.
โญ 1๏ธโฃ6๏ธโฃ Callback Functions
A function can be passed to another function.
function greet(name) {
console.log("Hello " + name);
}
function processUser(callback) {
callback("Rahul");
}
processUser(greet); // Hello RahulHere:
greet is passed as a value to processUser. This is called a callback function. Callbacks are extremely important in JavaScript because you'll encounter them throughout: Events, Array methods, Asynchronous programming, APIs, Node.jsโญ 1๏ธโฃ7๏ธโฃ Higher-Order Functions
A higher-order function is a function that: accepts another function as an argument, or returns a function.
function calculate(a, b, operation) {
return operation(a, b);
}
const add = (a, b) => a + b;
console.log(calculate(10, 5, add)); // 15Here "calculate()" receives another function. That's a higher-order function.
โญ 1๏ธโฃ8๏ธโฃ Functions Returning Functions
A function can also return another function.
function createGreeting(name) {
return function () {
console.log("Hello " + name);
};
}
const greetRahul = createGreeting("Rahul");
greetRahul(); // Hello RahulThis concept leads directly into one of JavaScript's most important advanced topics: Closures. We'll cover closures separately later.
1๏ธโฃ9๏ธโฃ Pure Functions
A pure function generally: 1. Produces the same output for the same input. 2. Doesn't modify external state.
Every time:
๐ง Real-World Example
Imagine an online shopping application.
Instead of putting everything into one huge block of code, each function handles a specific responsibility.
๐ง Double Tap โค๏ธ For More
1๏ธโฃ9๏ธโฃ Pure Functions
A pure function generally: 1. Produces the same output for the same input. 2. Doesn't modify external state.
function add(a, b) {
return a + b;
}Every time:
add(2, 3) returns: 5. A function that depends on changing external state can behave differently. Understanding pure functions becomes particularly useful when working with modern frontend frameworks.๐ง Real-World Example
Imagine an online shopping application.
function calculateDiscount(price, discount) {
return price - discount;
}
function calculateTax(price, taxRate) {
return price * taxRate;
}
let price = 2000;
let discountedPrice = calculateDiscount(price, 300);
let tax = calculateTax(discountedPrice, 0.18);
console.log(discountedPrice);
console.log(tax);Instead of putting everything into one huge block of code, each function handles a specific responsibility.
๐ง Double Tap โค๏ธ For More
โค5
๐ ๐ง๐ผ๐ฝ ๐๐ป-๐๐ฒ๐บ๐ฎ๐ป๐ฑ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป๐ ๐๐ผ ๐ ๐ฎ๐๐๐ฒ๐ฟ ๐ถ๐ป ๐ฎ๐ฌ๐ฎ๐ฒ
Explore these certification courses in todayโs most in-demand technology fields:
๐ป Full Stack :- https://pdlink.in/3SuUeuD
๐ Data Analytics :- https://pdlink.in/45vk5ph
๐ซAI Engineering :- https://pdlink.in/4fWJVID
๐ฅ Take the first step towards your high-paying tech career in 2026!
Explore these certification courses in todayโs most in-demand technology fields:
๐ป Full Stack :- https://pdlink.in/3SuUeuD
๐ Data Analytics :- https://pdlink.in/45vk5ph
๐ซAI Engineering :- https://pdlink.in/4fWJVID
๐ฅ Take the first step towards your high-paying tech career in 2026!
15 JavaScript Project Ideas for Freshers: โจ๐ป
๐ Beginner Level :
1. โฐ Digital Clock โ Show current time live with JavaScript.
2. โ To-Do List App โ Add, delete & mark tasks as complete.
3. โ Simple Calculator โ Build a calculator with basic operations.
4. ๐ง Quiz App โ Create a multiple-choice quiz with scores.
5. ๐๏ธ Age Calculator โ Enter DOB and get exact age.
๐ Intermediate Level :
6. ๐ Form Validator โ Validate email, password, and input fields.
7. ๐ข Number Guessing Game โ Let users guess a random number.
8. ๐ Weather App (API) โ Fetch live weather using OpenWeather API.
9. ๐ Quotes Generator โ Show random quotes with a refresh button.
10. ๐ก Dark Mode Toggle โ Add light/dark theme toggle to a webpage.
๐ Advanced Level :
11. ๐๏ธ Movie Search App โ Use OMDb API to search and display movies.
12. โ๏ธ Typing Speed Test โ Track how fast users can type.
13. ๐๏ธ Product Filter UI โ Filter products by category/price.
14. ๐ต Music Player โ Play, pause, skip songs with a cool UI.
15. ๐ง Memory Card Game โ Flip cards and match pairs for fun!
Like if it helps ๐โค๏ธ
๐ Beginner Level :
1. โฐ Digital Clock โ Show current time live with JavaScript.
2. โ To-Do List App โ Add, delete & mark tasks as complete.
3. โ Simple Calculator โ Build a calculator with basic operations.
4. ๐ง Quiz App โ Create a multiple-choice quiz with scores.
5. ๐๏ธ Age Calculator โ Enter DOB and get exact age.
๐ Intermediate Level :
6. ๐ Form Validator โ Validate email, password, and input fields.
7. ๐ข Number Guessing Game โ Let users guess a random number.
8. ๐ Weather App (API) โ Fetch live weather using OpenWeather API.
9. ๐ Quotes Generator โ Show random quotes with a refresh button.
10. ๐ก Dark Mode Toggle โ Add light/dark theme toggle to a webpage.
๐ Advanced Level :
11. ๐๏ธ Movie Search App โ Use OMDb API to search and display movies.
12. โ๏ธ Typing Speed Test โ Track how fast users can type.
13. ๐๏ธ Product Filter UI โ Filter products by category/price.
14. ๐ต Music Player โ Play, pause, skip songs with a cool UI.
15. ๐ง Memory Card Game โ Flip cards and match pairs for fun!
Like if it helps ๐โค๏ธ
โค7
๐๐ฅ๐๐ ๐๐ ๐๐ฎ๐ฟ๐ฒ๐ฒ๐ฟ ๐ ๐ฎ๐๐๐ฒ๐ฟ๐ฐ๐น๐ฎ๐๐ ๐
Join this expert-led masterclass and discover how to become industry-ready for high-growth AI roles.
๐ Date: 24 September 2026
โฐ Time: 7:00 PMโ9:00 PM IST
๐ Mode: Online
๐ Certificate: Available to all attendees
Eligibility :- Graduates Passing In 2025 or earlier
๐ ๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐ณ๐ผ๐ฟ ๐๐ฅ๐๐ ๐
https://pdlink.in/4xAMeGW
โก Register now and take your first step towards a successful career in AI!
Join this expert-led masterclass and discover how to become industry-ready for high-growth AI roles.
๐ Date: 24 September 2026
โฐ Time: 7:00 PMโ9:00 PM IST
๐ Mode: Online
๐ Certificate: Available to all attendees
Eligibility :- Graduates Passing In 2025 or earlier
๐ ๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐ณ๐ผ๐ฟ ๐๐ฅ๐๐ ๐
https://pdlink.in/4xAMeGW
โก Register now and take your first step towards a successful career in AI!
โค2