Web Development - HTML, CSS & JavaScript
Learn to code and become a Web Developer with HTML, CSS, JavaScript , Reactjs, Wordpress, PHP, Mern & Nodejs knowledge Managed by: @love_data
Ko'proq ko'rsatish📈 Telegram kanali Web Development - HTML, CSS & JavaScript analitikasi
Web Development - HTML, CSS & JavaScript (@javascript_courses) Ingliz til segmentidagi kanali faol ishtirokchi. Hozirda hamjamiyat 55 560 obunachidan iborat bo'lib, Texnologiyalar & Aralashmalar toifasida 2 393-o'rinni va Hindiston mintaqasida 6 089-o'rinni egallagan.
📊 Auditoriya ko‘rsatkichlari va dinamika
невідомо sanasidan buyon loyiha tez o‘sib, 55 560 obunachiga ega bo‘ldi.
15 Noyabr, 2026 dagi oxirgi ma’lumotlarga ko‘ra kanal barqaror faollikka ega. Oxirgi 30 kunda obunachilar soni -152 ga, so‘nggi 24 soatda esa -12 ga o‘zgardi va umumiy qamrov yuqori darajada qolmoqda.
- Tasdiqlash holati: Tasdiqlanmagan
- Jalb etish (ER): Auditoriya o‘rtacha 4.54% darajada jalb etiladi. Nashrdan keyingi dastlabki 24 soatda kontent odatda umumiy obunachilar sonining 1.19% ini tashkil etuvchi reaksiyalarni to‘playdi.
- Post qamrovi: Har bir post o‘rtacha 2 520 marta ko‘riladi; birinchi sutkada odatda 662 ta ko‘rish yig‘iladi.
- Reaksiyalar va o‘zaro ta’sir: Auditoriya faol: har bir postga o‘rtacha 12 ta reaksiya keladi.
- Tematik yo‘nalishlar: Kontent javascript, css, object, html, array kabi asosiy mavzularga jamlangan.
📝 Tavsif va kontent siyosati
Muallif resursni shaxsiy fikrni ifoda etish maydoni sifatida ta’riflaydi:
“Learn to code and become a Web Developer with HTML, CSS, JavaScript , Reactjs, Wordpress, PHP, Mern & Nodejs knowledge
Managed by: @love_data”
Yuqori yangilanish chastotasi (oxirgi ma’lumot 16 Noyabr, 2026 da olingan) sababli kanal doimo dolzarb va katta qamrovli bo‘lib qoladi. Analitika auditoriya kontent bilan faol hamkorlik qilishini, uni Texnologiyalar & Aralashmalar toifasidagi muhim ta’sir nuqtasiga aylantirishini ko‘rsatadi.
function calculateSalary(basicSalary, bonus) {
let totalSalary = basicSalary + bonus;
return totalSalary;
}
function displaySalary(name, salary) {
console.log("Employee:", name);
console.log("Total Salary:", salary);
}
let salary = calculateSalary(50000, 10000);
displaySalary("Rahul", salary);
Output:
Employee: Rahul
Total Salary: 60000
This example demonstrates how functions help organize and reuse business logic.
15. Common Mistakes Beginners Should Avoid
• Forgetting to call a function after declaring it.
• Confusing parameters with arguments.
• Forgetting the return statement.
• Using variables outside their scope.
• Confusing arrow functions with regular functions.
• Passing incorrect arguments.
• Creating unnecessarily large functions.
• Forgetting that a function without an explicit return statement returns undefined.
16. Quick Revision: Types of Functions
🔹 Function Declaration ➜ Defines a function using the function keyword.
🔹 Function Expression ➜ Stores a function inside a variable.
🔹 Arrow Function ➜ Provides shorter function syntax.
🔹 Anonymous Function ➜ Function without a name.
🔹 Callback Function ➜ Function passed as an argument to another function.
🔹 IIFE ➜ Function that executes immediately after definition.
🔹 Higher-Order Function ➜ Accepts or returns another function.
🔹 Recursive Function ➜ A function that calls itself.
Key Takeaways
• Functions make code reusable and organized.
• Parameters allow functions to accept input.
• Return statements send results back.
• Arrow functions simplify function syntax.
• Callbacks allow functions to work with other functions.
• Scope determines variable accessibility.
• Higher-order functions are important in modern JavaScript.
Double Tap ❤️ For More
-----
1.05 ₽ · /balance_helpthis binding.
7. Anonymous Functions
An anonymous function is a function without a name.
setTimeout(function() {
console.log("Hello after 2 seconds");
}, 2000);
Output after approximately 2 seconds:
Hello after 2 seconds
Anonymous functions are frequently used as callbacks.
8. Default Parameters
Default parameters provide fallback values when an argument is missing or undefined.
function greet(name = "Guest") {
console.log("Hello " + name);
}
greet("Rahul");
greet();
Output:
Hello Rahul
Hello Guest
9. Rest Parameters
Rest parameters allow a function to accept multiple arguments and collect them into an array.
function calculateTotal(...numbers) {
let total = 0;
for (let num of numbers) {
total += num;
}
return total;
}
console.log(calculateTotal(10, 20, 30, 40));
Output:
100
Here, ...numbers collects all the supplied arguments into one array.
10. Callback Functions
A callback is a function passed as an argument to another function.
function greet(name, callback) {
console.log("Hello " + name);
callback();
}
function message() {
console.log("Welcome to JavaScript");
}
greet("Rahul", message);
Output:
Hello Rahul
Welcome to JavaScript
Callbacks are widely used in:
• Event handling.
• Asynchronous programming.
• Array methods.
• API operations.
11. Immediately Invoked Function Expression (IIFE)
An IIFE is a function that executes immediately after it is defined.
(function() {
console.log("Function executed immediately");
})();
Output:
Function executed immediately
IIFEs were traditionally used to create private scopes and avoid polluting the global namespace.
12. Function Scope
Scope determines where a variable can be accessed.
JavaScript has different types of scope.
A. Global Scope
Variables declared outside functions and blocks may be accessible throughout their containing script or module environment.
let name = "Rahul";
function greet() {
console.log(name);
}
B. Function Scope
Variables declared with var inside a function are accessible within that function.
function test() {
var age = 25;
console.log(age);
}
test();
C. Block Scope
Variables declared using let and const inside a block are accessible only within that block.
if (true) {
let age = 25;
const city = "Delhi";
}
console.log(age); // ReferenceError
13. 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);
}
function add(x, y) {
return x + y;
}
console.log(calculate(10, 20, add));
Higher-order functions are widely used in functional programming and array operations.
14. Real-World Example: Employee Salary Calculatorfunction greet() {
console.log("Hello, Welcome!");
}
greet();
Output:
Hello, Welcome!
Explanation:
• function ➜ Keyword used to declare a function.
• greet ➜ Function name.
• () ➜ Holds parameters, if required.
• {} ➜ Contains the function's code.
• greet() ➜ Calls or executes the function.
Important: Defining a function does not automatically execute it. You must call it.
2. Function Declaration
A function declaration defines a function using the function keyword.
Syntax:
function functionName() {
// Code to execute
}
Example:
function welcome() {
console.log("Welcome to JavaScript");
}
welcome();
Output:
Welcome to JavaScript
Function declarations can generally be called before their definition because they are hoisted.
3. Functions with Parameters
Parameters allow you to pass information into a function.
function greet(name) {
console.log("Hello " + name);
}
greet("Rahul");
greet("Priya");
Output:
Hello Rahul
Hello Priya
Here:
• name is a parameter.
• "Rahul" and "Priya" are arguments.
Difference:
Parameter ➜ Variable listed in the function definition.
Argument ➜ Actual value passed when calling the function.
4. Functions with Return Values
The return statement sends a value back from a function.
function add(a, b) {
return a + b;
}
let result = add(10, 20);
console.log(result);
Output:
30
• The function receives two values.
• It adds them.
• return sends the result back.
• The result is stored in the result variable.
Important: return also terminates the function's execution.
5. Function Expression
A function expression stores a function inside a variable.
const greet = function() {
console.log("Hello JavaScript");
};
greet();
Output:
Hello JavaScript
Unlike function declarations, function expressions assigned to variables cannot generally be called before their initialization.
6. Arrow Functions
Arrow functions provide a shorter syntax for writing functions.
They were introduced in ES6.
Traditional function:
function add(a, b) {
return a + b;
}
Arrow function:
const add = (a, b) => {
return a + b;
};
console.log(add(10, 20));
Output:
30
For a single expression, you can write:
const add = (a, b) => a + b;
console.log(add(5, 10));
Output:
15break Statement
break immediately ends the loop.
for (let i = 1; i <= 10; i++) {
if (i === 5) {
break;
}
console.log(i);
}
1
2
3
4
When i becomes 5, the loop stops.
8. continue Statement
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);
}
1
2
4
5
The loop skips 3 but continues running.
9. Real-World Example: Calculate Total Salary
let salaries = [25000, 30000, 35000, 40000];
let total = 0;
for (let salary of salaries) {
total += salary;
}
console.log("Total Salary:", total);
Total Salary: 130000
The loop visits each salary and adds it to the total.
10. Common Loop Patterns
A. Print even numbers
for (let i = 2; i <= 10; i += 2) {
console.log(i);
}
Output: 2, 4, 6, 8, 10
B. Print numbers in reverse
for (let i = 10; i >= 1; i--) {
console.log(i);
}
C. Calculate the sum of numbers
let sum = 0;
for (let i = 1; i <= 10; i++) {
sum += i;
}
console.log(sum);
55
D. Print a multiplication table
let number = 5;
for (let i = 1; i <= 10; i++) {
console.log(number + " x " + i + " = " + (number * i));
}
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
...
5 x 10 = 50
11. Common Mistakes to Avoid
• Forgetting to update the loop variable.
• Using the wrong loop condition.
• Accidentally creating an infinite loop.
• Confusing break with continue.
• Using for...in unnecessarily for arrays.
• Making nested loops more complicated than necessary.
• Using <= instead of < when it causes an extra iteration.
12. Quick Revision: Types of Loops
🔹 for loop → Best when the number of iterations is known.
🔹 while loop → Repeats while a condition remains true.
🔹 do...while loop → Runs at least once before checking the condition.
🔹 for...of loop → Iterates over values in iterable objects.
🔹 for...in loop → Iterates over enumerable property keys.
🔹 Nested loop → A loop inside another loop.
🔹 break → Terminates the loop.
🔹 continue → Skips the current iteration.
Key Takeaways
• Loops automate repetitive tasks.
• Know when to use for, while, and do...while.
• Use for...of for iterable values and for...in for object property keys.
• Use break to stop a loop and continue to skip an iteration.
• Practice nested loops and common coding patterns.
Double Tap ❤️ For More
-----
0.978812 ₽ · /balance_helpconsole.log("Hello");
console.log("Hello");
console.log("Hello");
console.log("Hello");
console.log("Hello");
Using a loop:
for (let i = 1; i <= 5; i++) {
console.log("Hello");
}
Both produce the same output, but loops make code shorter and easier to maintain.
1. for Loop
A for loop is useful when you know how many times you want to run a block of code.
Syntax:
for (initialization; condition; update) {
// Code to execute
}
The three parts are:
• Initialization sets the starting value.
• Condition checks whether the loop should continue.
• Update changes the variable after each iteration.
Example:
for (let i = 1; i <= 5; i++) {
console.log(i);
}
Output:
1
2
3
4
5
Here, i starts at 1, increases by 1 after each iteration, and the loop ends when i <= 5 is false.
2. while Loop
A while loop runs as long as its condition is true. It’s useful when you don’t know exactly how many iterations are needed.
while (condition) {
// Code to execute
}
let i = 1;
while (i <= 5) {
console.log(i);
i++;
}
The condition is checked before each iteration. Make sure the loop can eventually end, or it may run forever.
3. do...while Loop
A do...while loop runs its code at least once before checking the condition.
do {
// Code to execute
} while (condition);
do {
console.log(i);
i++;
} while (i <= 5);
Key difference:
• for is commonly used when the number of iterations is known.
• while checks the condition before running the code.
• do...while runs the code once before checking the condition.
4. for...of Loop
Use for...of to iterate over values in iterables such as arrays, strings, maps, and sets.
Example: iterating through an array:
let fruits = ["Apple", "Mango", "Banana"];
for (let fruit of fruits) {
console.log(fruit);
}
Apple
Mango
Banana
Example: iterating through a string:
let name = "JavaScript";
for (let character of name) {
console.log(character);
}
This prints each character separately.
5. for...in Loop
Use for...in to iterate over an object's enumerable property keys.
let student = {
name: "Rahul",
age: 22,
city: "Delhi"
};
for (let key in student) {
console.log(key, student[key]);
}
name Rahul
age 22
city Delhi
key is the property name, and student[key] retrieves its value. For arrays, prefer for...of or array methods.
6. Nested Loops
A nested loop is a loop inside another loop. It’s commonly used for patterns, matrices, and multidimensional arrays.
for (let i = 1; i <= 3; i++) {
for (let j = 1; j <= 3; j++) {
console.log(i, j);
}
}
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3if ➜ Checks one condition.
🔹 if-else ➜ Chooses between two possible paths.if statement executes a block of code only when a condition is true.
Syntax:
if (condition) {
// Code executes if condition is true
}
Example:
let age = 20;
if (age >= 18) {
console.log("You are eligible to vote");
}
Output: You are eligible to vote
2. The if-else Statement
Executes one block when the condition is true and another when it is false.
let age = 16;
if (age >= 18) {
console.log("Eligible to vote");
} else {
console.log("Not eligible to vote");
}
Output: Not eligible to vote
3. The else-if Statement
Used when you need to check multiple conditions.
Example: Student Grading System
let marks = 85;
if (marks >= 90) {
console.log("Grade A");
} else if (marks >= 75) {
console.log("Grade B");
} else if (marks >= 60) {
console.log("Grade C");
} else if (marks >= 40) {
console.log("Grade D");
} else {
console.log("Fail");
}
Output: Grade B
4. Nested if Statements
An if statement inside another if statement is called a nested if statement.
Example: Login Verification
let username = "admin";
let password = "12345";
if (username === "admin") {
if (password === "12345") {
console.log("Login Successful");
} else {
console.log("Incorrect Password");
}
} else {
console.log("Invalid Username");
}
Output: Login Successful
5. The switch Statement
Used when you want to compare one expression against multiple possible values.
switch (expression) {
case value1:
// Code
break;
case value2:
// Code
break;
default:
// Default code
}
Example: Day of the Week
let day = 3;
switch (day) {
case 1:
console.log("Monday");
break;
case 2:
console.log("Tuesday");
break;
case 3:
console.log("Wednesday");
break;
default:
console.log("Invalid Day");
}
Output: Wednesday
Remember:
• case defines possible matching values.
• break prevents execution from falling through to the next case.
• default executes when no case matches.
6. Ternary Operator
A shorter way to write a simple if-else condition.
condition ? expression1 : expression2;
let age = 21;
let result = age >= 18
? "Adult"
: "Minor";
console.log(result);
Output: Adult
7. Multiple Conditions Using Logical Operators
AND (&&)
Both conditions must be true.
let age = 25;
let hasLicense = true;
if (age >= 18 && hasLicense) {
console.log("You can drive");
}
OR (||)
At least one condition must be true.
let isWeekend = false;
let isHoliday = true;
if (isWeekend || isHoliday) {
console.log("It's a day off");
}
NOT (!)
Reverses a Boolean condition.
let isLoggedIn = false;
if (!isLoggedIn) {
console.log("Please log in");
}
8. Real-World Example: Online Shopping Discount
let purchaseAmount = 5000;
let discount = 0;
if (purchaseAmount >= 5000) {
discount = 20;
} else if (purchaseAmount >= 3000) {
discount = 10;
} else if (purchaseAmount >= 1000) {
discount = 5;
}
let finalAmount =
purchaseAmount - (purchaseAmount * discount / 100);
console.log("Purchase:", purchaseAmount);
console.log("Discount:", discount + "%");
console.log("Final Amount:", finalAmount);
Output:
Purchase: 5000
Discount: 20%
Final Amount: 4000
9. Types of Conditional Statementslet value = "100";
let result = Number(value);
Output: 100
Number to String
let age = 25;
let result = String(age);
Output: 25 (as a string)
String to Boolean
let value = "Hello";
console.log(Boolean(value));
Output: true
8. Variable Naming Rules
Follow these rules when naming variables:
- Names can contain letters, numbers, _ and $.
- Names cannot start with a number.
- Variable names are case-sensitive.
- Reserved keywords cannot be used as variable names.
- Use meaningful names.
Good examples:
let firstName = "Rahul";
let totalPrice = 500;
let isLoggedIn = true;
Invalid examples:
let 1name = "Rahul";
let let = 100;
*Double Tap ❤️ For Part-3*let name = "John";
let age = 25;
let salary = 45000;
console.log(name);
console.log(age);
console.log(salary);
Output:
John
25
45000
Here:
• name stores a string.
• age stores a number.
• salary stores a number.
2. How to Declare Variables
JavaScript provides three main ways to declare variables.
A. var
• Function-scoped.
• Can be redeclared.
• Can be reassigned.
• Generally avoided in modern JavaScript.
var city = "Mumbai";
var city = "Pune";
console.log(city);
B. let
• Block-scoped.
• Cannot be redeclared in the same scope.
• Can be reassigned.
let age = 25;
age = 30;
console.log(age);
Output: 30
C. const
• Block-scoped.
• Cannot be redeclared in the same scope.
• Cannot be reassigned.
const country = "India";
console.log(country);
Output: India
Remember: A const object or array can still have its contents modified. The variable binding itself cannot be reassigned.
3. Difference Between var, let & const
Feature: Scope var: Function let: Block const: Block Feature: Reassignment var: Yes let: Yes const: No Feature: Redeclaration var: Yes let: No const: No Feature: Hoisting var: Yes let: Yes const: Yes Feature: Initialization required var: No let: No const: YesBest Practice: Use const by default and let when reassignment is required. Avoid var in modern JavaScript. 4. JavaScript Data Types JavaScript has two broad categories of data types. A. Primitive Data Types There are seven primitive types. 1. String Used to store text.
let name = "Rahul";
2. Number
Used for integers and decimal values.
let age = 25;
let price = 99.99;
3. Boolean
Stores either true or false.
let isActive = true;
let isCompleted = false;
4. Undefined
A variable that has been declared but not assigned a value.
let result;
console.log(result);
Output: undefined
5. Null
Represents an intentional absence of a value.
let selectedUser = null;
6. BigInt
Used for integers larger than the safe integer limit of the Number type.
let bigNumber = 12345678901234567890n;
7. Symbol
Creates unique identifiers.
let id = Symbol("user");
B. Non-Primitive Data Types
These are commonly represented using objects.
1. Object
Stores data in key-value pairs.
let student = {
name: "Rahul",
age: 22,
city: "Delhi"
};
2. Array
Stores multiple values in an ordered collection.
let fruits = ["Apple", "Mango", "Banana"];
3. Function
A reusable block of code.
function greet() {
console.log("Hello!");
}
5. Checking Data Types Using typeof
JavaScript provides the typeof operator to identify the type of a value.
console.log(typeof "Hello");
console.log(typeof 100);
console.log(typeof true);
console.log(typeof undefined);
console.log(typeof 100n);
console.log(typeof Symbol("id"));
console.log(typeof {});
string
number
boolean
undefined
bigint
symbol
object
Important: typeof null also returns "object". This is a historical JavaScript behavior.
6. Dynamic Typing in JavaScript
JavaScript is dynamically typed. This means a variable can hold different types of values during execution.
let data = 100;
console.log(data);
data = "Hello JavaScript";
console.log(data);
100
Hello JavaScript
The same variable first stores a number and then stores a string.
7. Type Conversion
Type conversion means converting one data type into another.
String to Number