├── G. DOM ├── DOM.txt ├── DOM-English.md ├── Method.md ├── Dom-Event-English.md ├── Dom-Event-Bangla.md └── DOM-Bangla.md ├── 0. Introduction ├── script.js ├── JS-Intro-English.md └── JS-Intro-Bangla.md ├── F. Function ├── Method.md ├── Function-Bangla.md ├── date-time.md ├── Math.md └── Function-English.md ├── H. ES6 ├── JSON.md ├── Array-Method.md ├── Bangla-ES6-Keywards.md ├── Object-Method.md ├── API.md ├── English-ES6-Keywards.md └── Keys-ASCII-Code.md ├── C. Array ├── Array-English.md └── Array-Bangla.md ├── Interview-Question └── Github-Question.md ├── D. Loop ├── Loop-English.md └── Loop-Bangla.md ├── B. Condition ├── Condition-English.md └── Condition-Bangla.md ├── A. Operator ├── Operator-English.md └── Operator-Bangla.md └── E. Object ├── Object-English.md └── Object-Bangla.md /G. DOM/DOM.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0. Introduction/script.js: -------------------------------------------------------------------------------- 1 | // Variable 2 | var elements = 'Oxygen'; 3 | let person = 'A Great Man'; 4 | const number = 200; 5 | 6 | // Condition 7 | let age = 22; 8 | if (age >= 20) { 9 | console.log('I will Get married'); 10 | } 11 | else { 12 | console.log('You Are Not Adult'); 13 | } 14 | 15 | // Array 16 | 17 | let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; 18 | 19 | // Loop 20 | for (let day = 1; day <= 60; day++) { 21 | console.log('I will invest at least 6 hrs every single day for next 60 days!', day); 22 | } 23 | 24 | // Object 25 | const mobile = { 26 | brand: 'Samsung', 27 | name: 'S20', 28 | color: 'Blue', 29 | isNew: true, 30 | price: '50K' 31 | } 32 | 33 | // function 34 | function sum(x, y) { 35 | addition = x + y; 36 | subtraction = x - y; 37 | multiplication = x * y; 38 | division = x / y; 39 | modulus = x % y; 40 | const results = ` Addition: ${addition} subtraction: ${subtraction} multiplication: ${multiplication} division: ${division} modulus:${modulus}`; 41 | return results; 42 | } 43 | // const number = (50, 30); 44 | const result = sum(5, 3) 45 | console.log(result); 46 | 47 | // Dom Document Object Model 48 | document.getElementById('btn').addEventListener('click', function () { 49 | document.body.style.backgroundColor = 'blue'; 50 | }) 51 | document.getElementById('btn').addEventListener('mouseover', function () { 52 | document.body.style.backgroundColor = 'red' 53 | }); 54 | -------------------------------------------------------------------------------- /F. Function/Method.md: -------------------------------------------------------------------------------- 1 | # 🚀 **JavaScript Function Methods: Full Guide with Examples** 2 | 3 | JavaScript-এ **Function** হল **reusable code blocks** যা নির্দিষ্ট কাজ সম্পন্ন করতে ব্যবহার করা হয়। ফাংশনের মধ্যে **methods** ব্যবহার করে আমরা ফাংশন সম্পর্কে তথ্য পেতে এবং কাস্টমাইজ করতে পারি। 4 | 5 | --- 6 | 7 | ## **📌 ১. Function Methods Overview** 8 | 9 | | Method | Description | 10 | |--------|------------| 11 | | `call()` | অন্য অবজেক্টের সাথে ফাংশন কল করে | 12 | | `apply()` | `call()` এর মতোই, কিন্তু arguments array হিসাবে নেয় | 13 | | `bind()` | ফাংশনের `this` সেট করে এবং নতুন ফাংশন তৈরি করে | 14 | | `toString()` | ফাংশনের সোর্স কোড স্ট্রিং আকারে ফেরত দেয় | 15 | | `length` | ফাংশনের প্যারামিটার সংখ্যা দেখায় | 16 | | `name` | ফাংশনের নাম ফেরত দেয় | 17 | 18 | --- 19 | 20 | ## **📌 ২. `call()` Method** 21 | 🔹 **একটি ফাংশনকে অন্য অবজেক্টের সাথে ব্যবহার করা যায়** 22 | 23 | ```js 24 | function greet() { 25 | console.log(`Hello, my name is ${this.name}`); 26 | } 27 | 28 | const person = { name: "Shihab" }; 29 | 30 | greet.call(person); 31 | ``` 32 | **✅ Output:** 33 | ``` 34 | Hello, my name is Shihab 35 | ``` 36 | 37 | ✔ **Explanation:** `call()` এর মাধ্যমে `greet` ফাংশনের `this` কে `person` অবজেক্টের সাথে যুক্ত করেছি। 38 | 39 | --- 40 | 41 | ## **📌 ৩. `apply()` Method** 42 | 🔹 **`call()` এর মতোই, কিন্তু arguments array হিসাবে নেয়** 43 | 44 | ```js 45 | function introduce(age, city) { 46 | console.log(`My name is ${this.name}, I am ${age} years old from ${city}`); 47 | } 48 | 49 | const user = { name: "Shihab" }; 50 | 51 | introduce.apply(user, [25, "Dhaka"]); 52 | ``` 53 | **✅ Output:** 54 | ``` 55 | My name is Shihab, I am 25 years old from Dhaka 56 | ``` 57 | 58 | ✔ **Difference from `call()`** → `apply()` এর ক্ষেত্রে arguments **array আকারে** দেওয়া হয়। 59 | 60 | --- 61 | 62 | ## **📌 ৪. `bind()` Method** 63 | 🔹 **একটি ফাংশনের `this` সেট করে নতুন ফাংশন তৈরি করে** 64 | 65 | ```js 66 | function sayHi() { 67 | console.log(`Hi, ${this.name}`); 68 | } 69 | 70 | const person = { name: "Shihab" }; 71 | 72 | const boundFunction = sayHi.bind(person); 73 | boundFunction(); 74 | ``` 75 | **✅ Output:** 76 | ``` 77 | Hi, Shihab 78 | ``` 79 | 80 | ✔ **Explanation:** `bind()` ফাংশনকে **নতুন ফাংশনে রূপান্তর করে এবং `this` সেট করে**। 81 | 82 | --- 83 | 84 | ## **📌 ৫. `toString()` Method** 85 | 🔹 **ফাংশনের সোর্স কোড স্ট্রিং আকারে দেখায়** 86 | 87 | ```js 88 | function example() { 89 | return "Hello World"; 90 | } 91 | 92 | console.log(example.toString()); 93 | ``` 94 | **✅ Output:** 95 | ``` 96 | function example() { 97 | return "Hello World"; 98 | } 99 | ``` 100 | 101 | ✔ **Explanation:** `toString()` ব্যবহার করে **ফাংশনের সোর্স কোড** প্রিন্ট করা যায়। 102 | 103 | --- 104 | 105 | ## **📌 ৬. `length` Property** 106 | 🔹 **ফাংশনে কয়টি প্যারামিটার আছে তা দেখায়** 107 | 108 | ```js 109 | function sum(a, b, c) { 110 | return a + b + c; 111 | } 112 | 113 | console.log(sum.length); 114 | ``` 115 | **✅ Output:** 116 | ``` 117 | 3 118 | ``` 119 | 120 | ✔ **Explanation:** `sum.length` → **৩টি প্যারামিটার আছে** তাই `3` রিটার্ন করবে। 121 | 122 | --- 123 | 124 | ## **📌 ৭. `name` Property** 125 | 🔹 **ফাংশনের নাম বের করা যায়** 126 | 127 | ```js 128 | function multiply(x, y) { 129 | return x * y; 130 | } 131 | 132 | console.log(multiply.name); 133 | ``` 134 | **✅ Output:** 135 | ``` 136 | multiply 137 | ``` 138 | 139 | ✔ **Explanation:** `name` প্রপার্টি **ফাংশনের নাম** রিটার্ন করে। 140 | 141 | --- 142 | 143 | ## **📌 ৮. Function Methods Use Cases (প্রয়োগ)** 144 | 145 | ✅ **`call()` ও `apply()`** ব্যবহার করা হয় **অন্য অবজেক্টের সাথে ফাংশন ব্যবহার করতে**। 146 | ✅ **`bind()`** ব্যবহার করে **ফাংশনের `this` সেট করা যায়**। 147 | ✅ **`toString()`** ব্যবহার করে **ফাংশনের সোর্স কোড দেখা যায়**। 148 | ✅ **`length` ও `name`** ব্যবহার করে **ফাংশনের প্যারামিটার ও নাম জানা যায়**। 149 | -------------------------------------------------------------------------------- /H. ES6/JSON.md: -------------------------------------------------------------------------------- 1 | ## **🔹 JSON (JavaScript Object Notation) All About** 2 | 3 | ✅ **JSON (JavaScript Object Notation)** হলো **lightweight data format**, যা **data store & transfer** করতে ব্যবহৃত হয়। 4 | ✅ এটি মূলত **text-based format**, যা **JavaScript Object-এর মতো দেখতে**, কিন্তু **stringified**। 5 | ✅ এটি **API request/response**, **configuration files**, **database storage** ইত্যাদির জন্য বহুল ব্যবহৃত হয়। 6 | 7 | --- 8 | 9 | ## **🔹 JSON Syntax (সংগঠন)** 10 | 👉 JSON-এর মূলত দুইটি structure থাকে: 11 | 1️⃣ **Object (`{ key: value }` format)** 12 | 2️⃣ **Array (`[ { key: value }, { key: value } ]` format)** 13 | 14 | **✅ JSON Object Example** 15 | ```json 16 | { 17 | "name": "John Doe", 18 | "age": 25, 19 | "isStudent": false, 20 | "skills": ["HTML", "CSS", "JavaScript"] 21 | } 22 | ``` 23 | 24 | **✅ JSON Array Example** 25 | ```json 26 | [ 27 | { 28 | "id": 1, 29 | "name": "Alice", 30 | "age": 22 31 | }, 32 | { 33 | "id": 2, 34 | "name": "Bob", 35 | "age": 30 36 | } 37 | ] 38 | ``` 39 | 40 | --- 41 | 42 | ## **🔹 JSON এর সাথে JavaScript এ কাজ করা** 43 | JavaScript এ JSON-এর সাথে কাজ করতে **`JSON.stringify()`** এবং **`JSON.parse()`** ব্যবহার করা হয়। 44 | 45 | ### **✅ `JSON.stringify()` (Object → JSON String)** 46 | 👉 এটি একটি JavaScript Object-কে **JSON format-এর string**-এ রূপান্তর করে। 47 | ```js 48 | const user = { name: "John", age: 25, isStudent: false }; 49 | const jsonString = JSON.stringify(user); 50 | console.log(jsonString); 51 | // Output: '{"name":"John","age":25,"isStudent":false}' 52 | ``` 53 | --- 54 | 55 | ### **✅ `JSON.parse()` (JSON String → Object)** 56 | 👉 এটি **JSON format-এর string কে JavaScript Object-এ** রূপান্তর করে। 57 | ```js 58 | const jsonString = '{"name":"John","age":25,"isStudent":false}'; 59 | const user = JSON.parse(jsonString); 60 | console.log(user.name); // Output: John 61 | ``` 62 | --- 63 | 64 | ## **🔹 JSON Fetch API ব্যবহার করে Data লোড করা (Arrow Function)** 65 | 👉 নিচের কোডটি **API থেকে JSON data লোড করার জন্য** `fetch()` ব্যবহার করে। 66 | 👉 এখানে **Arrow Function + `async/await`** ব্যবহার করা হয়েছে। 67 | 68 | ```js 69 | const fetchUsers = async () => { 70 | try { 71 | let response = await fetch('https://jsonplaceholder.typicode.com/users'); 72 | let data = await response.json(); 73 | console.log(data); 74 | } catch (error) { 75 | console.error("Error:", error.message); 76 | } 77 | }; 78 | 79 | fetchUsers(); 80 | ``` 81 | 👉 এখানে `fetch()` দিয়ে API কল করা হয়েছে, **`await` দিয়ে response-এর জন্য অপেক্ষা করা হয়েছে, এবং `JSON.parse()` ছাড়াই `response.json()` দিয়ে JSON-কে object-এ কনভার্ট করা হয়েছে।** 82 | 83 | --- 84 | 85 | ## **🔹 JSON Local Storage এ সংরক্ষণ ও পুনরুদ্ধার (Arrow Function)** 86 | ✅ **JSON data Local Storage-এ save ও retrieve করা যায়।** 87 | ```js 88 | // JSON Data Store (Arrow Function) 89 | const saveUser = (user) => { 90 | localStorage.setItem("user", JSON.stringify(user)); 91 | }; 92 | 93 | // JSON Data Retrieve (Arrow Function) 94 | const getUser = () => { 95 | let user = localStorage.getItem("user"); 96 | return user ? JSON.parse(user) : null; 97 | }; 98 | 99 | // Example Usage 100 | const user = { name: "Alice", age: 28 }; 101 | saveUser(user); 102 | 103 | console.log(getUser()); // Output: { name: "Alice", age: 28 } 104 | ``` 105 | 👉 **Local Storage-এ Object রাখার সময় `JSON.stringify()` ব্যবহার করতে হয়। 106 | 👉 Data রিড করার সময় `JSON.parse()` ব্যবহার করে Object-এ রূপান্তর করতে হয়।** 107 | 108 | --- 109 | 110 | ## **📌 সংক্ষেপে (JSON Summary)** 111 | ✔️ **JSON হল lightweight data format, যা API ও data transfer-এর জন্য ব্যবহৃত হয়।** 112 | ✔️ **JavaScript-এর জন্য `JSON.stringify()` ও `JSON.parse()` মেইন দুটি মেথড।** 113 | ✔️ **API থেকে JSON Data লোড করতে `fetch()` ও `response.json()` ব্যবহার করা হয়।** 114 | ✔️ **Local Storage-এ data সংরক্ষণ ও পুনরুদ্ধারের জন্য JSON ব্যবহার করা হয়।** 115 | 116 | --- -------------------------------------------------------------------------------- /F. Function/Function-Bangla.md: -------------------------------------------------------------------------------- 1 | # 🚀 **JavaScript Function: A Complete Guide with Real Examples** 2 | 3 | ## **📌 Function কি?** 4 | একটি **Function** হলো কোডের একটি ব্লক যা নির্দিষ্ট কাজ সম্পন্ন করতে বারবার ব্যবহার করা যায়। এটি কোডকে **Reusable** এবং **Modular** করে। 5 | 6 | --- 7 | 8 | ## **📌 Function লেখার নিয়ম (Syntax)** 9 | ```js 10 | function functionName(parameters) { 11 | // Function Body (কোড লিখতে হবে) 12 | return result; // (Optional) 13 | } 14 | ``` 15 | **🔹 `functionName`** → ফাংশনের নাম 16 | **🔹 `parameters`** → ইনপুট হিসেবে নেওয়া ডাটা (Optional) 17 | **🔹 `return`** → আউটপুট রিটার্ন করা হয় (Optional) 18 | 19 | --- 20 | 21 | ## **📌 ১. Simple Function Example (ফাংশন ডিফাইন ও কল করা)** 22 | ```js 23 | function greet() { 24 | console.log("Hello, Welcome to JavaScript!"); 25 | } 26 | greet(); // Function Call 27 | ``` 28 | **✅ Output:** 29 | ``` 30 | Hello, Welcome to JavaScript! 31 | ``` 32 | 33 | --- 34 | 35 | ## **📌 ২. Function with Parameters (Argument নেয়া ফাংশন)** 36 | ```js 37 | function add(a, b) { 38 | return a + b; 39 | } 40 | console.log(add(5, 3)); 41 | ``` 42 | **✅ Output:** 43 | ``` 44 | 8 45 | ``` 46 | 47 | --- 48 | 49 | ## **📌 ৩. Function with Default Parameter** 50 | ```js 51 | function multiply(a, b = 2) { // Default value 2 52 | return a * b; 53 | } 54 | console.log(multiply(5)); // 5 * 2 = 10 55 | console.log(multiply(5, 3)); // 5 * 3 = 15 56 | ``` 57 | **✅ Output:** 58 | ``` 59 | 10 60 | 15 61 | ``` 62 | 63 | --- 64 | 65 | ## **📌 ৪. Function Expression (Anonymous Function)** 66 | ```js 67 | const divide = function(a, b) { 68 | return a / b; 69 | }; 70 | console.log(divide(10, 2)); // 5 71 | ``` 72 | **✅ Output:** 73 | ``` 74 | 5 75 | ``` 76 | 77 | --- 78 | 79 | ## **📌 ৫. Arrow Function (ES6)** 80 | ```js 81 | const square = (num) => num * num; 82 | console.log(square(4)); // 16 83 | ``` 84 | **✅ Output:** 85 | ``` 86 | 16 87 | ``` 88 | 89 | --- 90 | 91 | ## **📌 ৬. Immediately Invoked Function Expression (IIFE)** 92 | ```js 93 | (function() { 94 | console.log("IIFE Executed!"); 95 | })(); 96 | ``` 97 | **✅ Output:** 98 | ``` 99 | IIFE Executed! 100 | ``` 101 | 102 | --- 103 | 104 | ## **📌 ৭. Function with Rest Parameters** 105 | ```js 106 | function sum(...numbers) { 107 | return numbers.reduce((acc, num) => acc + num, 0); 108 | } 109 | console.log(sum(1, 2, 3, 4, 5)); // 15 110 | ``` 111 | **✅ Output:** 112 | ``` 113 | 15 114 | ``` 115 | 116 | --- 117 | 118 | ## **📌 ৮. Callback Function (Function as an Argument)** 119 | ```js 120 | function processUserInput(name, callback) { 121 | console.log("User Name:", name); 122 | callback(); 123 | } 124 | 125 | function sayHello() { 126 | console.log("Hello, How are you?"); 127 | } 128 | 129 | processUserInput("Shihab", sayHello); 130 | ``` 131 | **✅ Output:** 132 | ``` 133 | User Name: Shihab 134 | Hello, How are you? 135 | ``` 136 | 137 | --- 138 | 139 | ## **📌 ৯. Higher Order Function (Function Returns Another Function)** 140 | ```js 141 | function multiplier(factor) { 142 | return function(number) { 143 | return number * factor; 144 | }; 145 | } 146 | 147 | const double = multiplier(2); 148 | console.log(double(5)); // 10 149 | ``` 150 | **✅ Output:** 151 | ``` 152 | 10 153 | ``` 154 | 155 | --- 156 | 157 | ## **📌 ১০. Recursive Function (Self Calling Function)** 158 | ```js 159 | function factorial(n) { 160 | if (n === 0) return 1; 161 | return n * factorial(n - 1); 162 | } 163 | 164 | console.log(factorial(5)); // 5! = 5*4*3*2*1 = 120 165 | ``` 166 | **✅ Output:** 167 | ``` 168 | 120 169 | ``` 170 | 171 | --- 172 | 173 | ## **📌 ১১. Function Inside an Object (Method)** 174 | ```js 175 | const person = { 176 | name: "Shihab", 177 | greet: function() { 178 | console.log("Hello, " + this.name); 179 | } 180 | }; 181 | person.greet(); 182 | ``` 183 | **✅ Output:** 184 | ``` 185 | Hello, Shihab 186 | ``` 187 | 188 | --- 189 | 190 | ## **📌 ১২. Asynchronous Function (Async/Await)** 191 | ```js 192 | async function fetchData() { 193 | let response = await fetch("https://jsonplaceholder.typicode.com/posts/1"); 194 | let data = await response.json(); 195 | console.log(data); 196 | } 197 | fetchData(); 198 | ``` 199 | **✅ Output:** 200 | ```json 201 | { "userId": 1, "id": 1, "title": "sample title", "body": "sample body text..." } 202 | ``` 203 | 204 | --- 205 | 206 | ### **🚀 শেষ কথা:** 207 | ✅ Function হলো **JavaScript-এর মূল ভিত্তি**। 208 | ✅ এটি **কোড Reusability ও Maintainability** বাড়ায়। 209 | ✅ **Callback, Higher Order Function, Recursion** ইত্যাদি শিখলে JavaScript-এ দক্ষ হওয়া সহজ হবে! -------------------------------------------------------------------------------- /C. Array/Array-English.md: -------------------------------------------------------------------------------- 1 | ### **JavaScript Arrays - Everything You Need to Know** 2 | 3 | An **array** in JavaScript is a special variable that can store multiple values in a single variable. It is one of the most commonly used data structures. 4 | 5 | --- 6 | 7 | ## **1. Creating an Array** 8 | ### **Using an Array Literal (Recommended)** 9 | ```javascript 10 | let fruits = ["Apple", "Banana", "Mango"]; 11 | console.log(fruits); // Output: ["Apple", "Banana", "Mango"] 12 | ``` 13 | ### **Using the `new Array()` Constructor** 14 | ```javascript 15 | let numbers = new Array(1, 2, 3, 4, 5); 16 | console.log(numbers); // Output: [1, 2, 3, 4, 5] 17 | ``` 18 | --- 19 | 20 | ## **2. Accessing Array Elements** 21 | Each element in an array has an **index**, starting from `0`. 22 | ```javascript 23 | let colors = ["Red", "Green", "Blue"]; 24 | console.log(colors[0]); // Output: "Red" 25 | console.log(colors[2]); // Output: "Blue" 26 | ``` 27 | --- 28 | 29 | ## **3. Modifying an Array** 30 | ```javascript 31 | let cars = ["Toyota", "BMW", "Tesla"]; 32 | cars[1] = "Mercedes"; // Changing BMW to Mercedes 33 | console.log(cars); // Output: ["Toyota", "Mercedes", "Tesla"] 34 | ``` 35 | --- 36 | 37 | ## **4. Array Properties** 38 | ### **`length` - Get the number of elements in an array** 39 | ```javascript 40 | let languages = ["JavaScript", "Python", "C++"]; 41 | console.log(languages.length); // Output: 3 42 | ``` 43 | --- 44 | 45 | ## **5. Array Methods** 46 | ### **A. Adding & Removing Elements** 47 | #### **`push()` - Add an element at the end** 48 | ```javascript 49 | let animals = ["Cat", "Dog"]; 50 | animals.push("Elephant"); 51 | console.log(animals); // Output: ["Cat", "Dog", "Elephant"] 52 | ``` 53 | 54 | #### **`pop()` - Remove the last element** 55 | ```javascript 56 | animals.pop(); 57 | console.log(animals); // Output: ["Cat", "Dog"] 58 | ``` 59 | 60 | #### **`unshift()` - Add an element at the beginning** 61 | ```javascript 62 | animals.unshift("Lion"); 63 | console.log(animals); // Output: ["Lion", "Cat", "Dog"] 64 | ``` 65 | 66 | #### **`shift()` - Remove the first element** 67 | ```javascript 68 | animals.shift(); 69 | console.log(animals); // Output: ["Cat", "Dog"] 70 | ``` 71 | 72 | --- 73 | 74 | ### **B. Merging & Slicing Arrays** 75 | #### **`concat()` - Merge two arrays** 76 | ```javascript 77 | let arr1 = [1, 2, 3]; 78 | let arr2 = [4, 5, 6]; 79 | let combined = arr1.concat(arr2); 80 | console.log(combined); // Output: [1, 2, 3, 4, 5, 6] 81 | ``` 82 | 83 | #### **`slice()` - Extract elements from an array** 84 | ```javascript 85 | let numbers = [10, 20, 30, 40, 50]; 86 | let sliced = numbers.slice(1, 4); // Extracts index 1 to 3 (4 is excluded) 87 | console.log(sliced); // Output: [20, 30, 40] 88 | ``` 89 | 90 | --- 91 | 92 | ### **C. Modifying and Sorting** 93 | #### **`splice()` - Remove or Replace elements** 94 | ```javascript 95 | let cities = ["New York", "London", "Paris"]; 96 | cities.splice(1, 1, "Tokyo"); // Removes 1 element at index 1 and adds "Tokyo" 97 | console.log(cities); // Output: ["New York", "Tokyo", "Paris"] 98 | ``` 99 | 100 | #### **`sort()` - Sort an array (Alphabetically)** 101 | ```javascript 102 | let letters = ["D", "A", "C", "B"]; 103 | letters.sort(); 104 | console.log(letters); // Output: ["A", "B", "C", "D"] 105 | ``` 106 | 107 | #### **`reverse()` - Reverse an array** 108 | ```javascript 109 | letters.reverse(); 110 | console.log(letters); // Output: ["D", "C", "B", "A"] 111 | ``` 112 | 113 | --- 114 | 115 | ### **D. Searching** 116 | #### **`indexOf()` - Find the index of an element** 117 | ```javascript 118 | let items = ["Pen", "Pencil", "Eraser"]; 119 | console.log(items.indexOf("Pencil")); // Output: 1 120 | ``` 121 | 122 | #### **`includes()` - Check if an element exists** 123 | ```javascript 124 | console.log(items.includes("Marker")); // Output: false 125 | console.log(items.includes("Pen")); // Output: true 126 | ``` 127 | 128 | --- 129 | 130 | ## **6. Looping Through an Array** 131 | ### **Using `for` loop** 132 | ```javascript 133 | let numbers = [10, 20, 30, 40]; 134 | for (let i = 0; i < numbers.length; i++) { 135 | console.log(numbers[i]); 136 | } 137 | // Output: 10 20 30 40 138 | ``` 139 | 140 | ### **Using `forEach()` (Recommended)** 141 | ```javascript 142 | numbers.forEach(function(num) { 143 | console.log(num); 144 | }); 145 | ``` 146 | 147 | ### **Using `map()` (Creates a new array)** 148 | ```javascript 149 | let squared = numbers.map(num => num * num); 150 | console.log(squared); // Output: [100, 400, 900, 1600] 151 | ``` 152 | 153 | --- 154 | 155 | ## **7. Advanced Array Methods** 156 | ### **`filter()` - Returns a new array with elements that pass a test** 157 | ```javascript 158 | let ages = [12, 18, 22, 30, 40]; 159 | let adults = ages.filter(age => age >= 18); 160 | console.log(adults); // Output: [18, 22, 30, 40] 161 | ``` 162 | 163 | ### **`reduce()` - Reduces an array to a single value** 164 | ```javascript 165 | let numbers = [1, 2, 3, 4, 5]; 166 | let sum = numbers.reduce((total, num) => total + num, 0); 167 | console.log(sum); // Output: 15 168 | ``` 169 | 170 | --- 171 | 172 | ## **8. Multi-Dimensional Arrays** 173 | An **array inside an array** is called a **multi-dimensional array**. 174 | ```javascript 175 | let matrix = [ 176 | [1, 2, 3], 177 | [4, 5, 6], 178 | [7, 8, 9] 179 | ]; 180 | 181 | console.log(matrix[1][2]); // Output: 6 182 | ``` 183 | 184 | --- 185 | 186 | ## **Conclusion** 187 | JavaScript arrays are **powerful and flexible**, allowing you to store, modify, and manipulate data efficiently. 188 | Would you like to practice with some exercises? 🚀 -------------------------------------------------------------------------------- /G. DOM/DOM-English.md: -------------------------------------------------------------------------------- 1 | # **🔍 JavaScript DOM (Document Object Model) Explained** 2 | 3 | The **DOM (Document Object Model)** in JavaScript is an **API** that represents an HTML document as a **tree structure**, allowing developers to manipulate elements dynamically. 4 | 5 | --- 6 | 7 | ## **✅ 1. How Does the DOM Work?** 8 | ### **📌 DOM Tree Structure** 9 | 10 | When a webpage loads, the browser converts it into a **tree structure** where each element becomes a **node** in the tree. 11 | 12 | 🔹 **HTML Code Example:** 13 | ```html 14 | 15 | 16 | 17 | DOM Example 18 | 19 | 20 |

Hello, DOM!

21 |

This is a DOM tutorial.

22 | 23 | 24 | 25 | ``` 26 | 27 | 🔹 **DOM Tree Representation:** 28 | ``` 29 | Document 30 | │ 31 | ├── 32 | │ ├── 33 | │ │ ├── DOM Example 34 | │ ├── 35 | │ ├──

Hello, DOM!

36 | │ ├──

This is a DOM tutorial.

37 | │ ├── 38 | ``` 39 | 🔹 **Explanation:** 40 | 👉 `document` is the **root object** 41 | 👉 `html`, `head`, `body` are **child nodes** 42 | 👉 `h1`, `p`, `button` are **element nodes** 43 | 44 | --- 45 | 46 | ## **✅ 2. Important DOM Methods & Properties** 47 | 48 | | **Method / Property** | **Function** | **Example** | 49 | |------------------|------------|----------------| 50 | | `document.getElementById(id)` | **Finds an element by ID** | `document.getElementById("title")` | 51 | | `document.getElementsByClassName(class)` | **Finds all elements with a class** | `document.getElementsByClassName("description")` | 52 | | `document.getElementsByTagName(tag)` | **Finds all elements with a tag** | `document.getElementsByTagName("p")` | 53 | | `document.querySelector(selector)` | **Finds the first matching element** | `document.querySelector(".description")` | 54 | | `document.querySelectorAll(selector)` | **Finds all matching elements** | `document.querySelectorAll("p")` | 55 | | `.innerHTML` | **Changes HTML content** | `document.getElementById("title").innerHTML = "New Title"` | 56 | | `.innerText` | **Changes text content** | `document.getElementById("title").innerText = "Hello!"` | 57 | | `.style.property` | **Changes CSS style** | `document.getElementById("title").style.color = "red"` | 58 | | `document.createElement(tag)` | **Creates a new element** | `document.createElement("div")` | 59 | | `element.appendChild(node)` | **Adds a new element inside another** | `document.body.appendChild(newDiv)` | 60 | | `element.removeChild(node)` | **Removes an element** | `document.body.removeChild(oldElement)` | 61 | 62 | --- 63 | 64 | ## **✅ 3. DOM Manipulation (Modifications) Examples** 65 | 66 | ### **📌 1. Changing an Element by ID** 67 | ```javascript 68 | document.getElementById("title").innerHTML = "Welcome to DOM!"; 69 | document.getElementById("title").style.color = "blue"; 70 | ``` 71 | 72 | --- 73 | 74 | ### **📌 2. Changing Elements by Class Name** 75 | ```javascript 76 | let elements = document.getElementsByClassName("description"); 77 | elements[0].innerText = "Updated Description!"; 78 | ``` 79 | 80 | --- 81 | 82 | ### **📌 3. Using `querySelector()` and `querySelectorAll()`** 83 | ```javascript 84 | document.querySelector(".description").style.color = "green"; 85 | 86 | let paragraphs = document.querySelectorAll("p"); 87 | paragraphs.forEach(p => p.style.fontSize = "20px"); 88 | ``` 89 | 90 | --- 91 | 92 | ### **📌 4. Creating and Adding a New HTML Element** 93 | ```javascript 94 | let newParagraph = document.createElement("p"); 95 | newParagraph.innerText = "This is a new paragraph!"; 96 | document.body.appendChild(newParagraph); 97 | ``` 98 | 99 | --- 100 | 101 | ### **📌 5. Removing an Element using `removeChild()`** 102 | ```javascript 103 | let elementToRemove = document.getElementById("title"); 104 | document.body.removeChild(elementToRemove); 105 | ``` 106 | 107 | --- 108 | 109 | ## **✅ 4. Event Handling in DOM** 110 | JavaScript allows interaction with HTML elements using event listeners. 111 | 112 | ### **📌 1. `onclick` Event to Change Text on Button Click** 113 | ```javascript 114 | function changeText() { 115 | document.getElementById("title").innerText = "Button Clicked!"; 116 | } 117 | ``` 118 | 119 | 🔹 **HTML Button:** 120 | ```html 121 | 122 | ``` 123 | 124 | --- 125 | 126 | ### **📌 2. Using `addEventListener()` for Event Handling** 127 | ```javascript 128 | document.getElementById("title").addEventListener("mouseover", function() { 129 | this.style.color = "red"; 130 | }); 131 | ``` 132 | 👉 This changes the `title` color to red when hovered over. 133 | 134 | --- 135 | 136 | ## **✅ 5. Real-Life Use Cases** 137 | | **Use Case** | **DOM Methods** | 138 | |------------|-------------| 139 | | Updating webpage data dynamically | `innerHTML`, `innerText` | 140 | | Validating forms | `getElementById()`, `addEventListener()` | 141 | | Adding new elements dynamically | `createElement()`, `appendChild()` | 142 | | Handling user interactions | `addEventListener()` | 143 | | Loading data using AJAX | `document.querySelector()` | 144 | 145 | --- 146 | 147 | ## **✅ 6. Summary** 148 | 🔹 **DOM is an Object Model of an HTML page that JavaScript can control.** 149 | 🔹 **It represents the document as a "Tree Structure" with nodes.** 150 | 🔹 **JavaScript can manipulate DOM elements, update styles, and handle events.** 151 | 🔹 **Key methods include `getElementById()`, `querySelector()`, `innerHTML`, and `addEventListener()`.** 152 | -------------------------------------------------------------------------------- /F. Function/date-time.md: -------------------------------------------------------------------------------- 1 | # 🚀 **JavaScript Date & Time: Full Guide with Examples** 2 | 3 | JavaScript-এ **Date** এবং **Time** ম্যানেজ করতে `Date` অবজেক্ট ব্যবহার করা হয়। এটি বর্তমান সময়, তারিখ, টাইমস্ট্যাম্প, এবং টাইম ফরম্যাটিং ইত্যাদির জন্য ব্যবহৃত হয়। 4 | 5 | --- 6 | 7 | ## **📌 ১. Date Object তৈরি করার উপায়** 8 | JavaScript-এ **Date Object** তৈরি করার ৪টি উপায় আছে: 9 | 10 | | Syntax | Description | 11 | |--------|------------| 12 | | `new Date()` | বর্তমান তারিখ ও সময় প্রদান করবে | 13 | | `new Date(milliseconds)` | Unix Timestamp অনুযায়ী সময় সেট করবে | 14 | | `new Date(year, month, day, hours, minutes, seconds, ms)` | নির্দিষ্ট তারিখ ও সময় সেট করা যাবে | 15 | | `new Date(dateString)` | তারিখ স্ট্রিং ব্যবহার করে সেট করা | 16 | 17 | 🔹 **Example:** 18 | ```js 19 | console.log(new Date()); // বর্তমান সময় দেখাবে 20 | console.log(new Date(2025, 1, 12)); // নির্দিষ্ট তারিখ 21 | console.log(new Date("2025-02-12")); // স্ট্রিং থেকে তারিখ 22 | console.log(new Date(0)); // 1970-01-01 00:00:00 UTC 23 | ``` 24 | 25 | --- 26 | 27 | ## **📌 ২. Date Methods (তারিখ সম্পর্কিত মেথড)** 28 | | Method | Description | Example Output | 29 | |--------|------------|----------------| 30 | | `getFullYear()` | বছর ফেরত দেয় | `2025` | 31 | | `getMonth()` | মাস (0-11) ফেরত দেয় | `1` (February) | 32 | | `getDate()` | মাসের তারিখ ফেরত দেয় | `12` | 33 | | `getDay()` | সপ্তাহের দিন (0-6) ফেরত দেয় | `3` (Wednesday) | 34 | | `getHours()` | ঘণ্টা (0-23) ফেরত দেয় | `14` | 35 | | `getMinutes()` | মিনিট ফেরত দেয় | `30` | 36 | | `getSeconds()` | সেকেন্ড ফেরত দেয় | `45` | 37 | | `getMilliseconds()` | মিলিসেকেন্ড ফেরত দেয় | `500` | 38 | 39 | 🔹 **Example:** 40 | ```js 41 | let now = new Date(); 42 | console.log(now.getFullYear()); // 2025 43 | console.log(now.getMonth()); // 1 (February) 44 | console.log(now.getDate()); // 12 45 | console.log(now.getDay()); // 3 (Wednesday) 46 | console.log(now.getHours()); // 14 47 | console.log(now.getMinutes()); // 30 48 | console.log(now.getSeconds()); // 45 49 | ``` 50 | 51 | --- 52 | 53 | ## **📌 ৩. Date Formatting (তারিখ কাস্টমাইজ করা)** 54 | 🔹 **Example:** 55 | ```js 56 | let date = new Date(); 57 | let formattedDate = `${date.getDate()}-${date.getMonth() + 1}-${date.getFullYear()}`; 58 | console.log(formattedDate); 59 | ``` 60 | **✅ Output:** 61 | ``` 62 | 12-2-2025 63 | ``` 64 | 65 | --- 66 | 67 | ## **📌 ৪. Set Methods (তারিখ ও সময় পরিবর্তন করা)** 68 | | Method | Description | 69 | |--------|------------| 70 | | `setFullYear(year)` | নির্দিষ্ট বছর সেট করে | 71 | | `setMonth(month)` | নির্দিষ্ট মাস সেট করে | 72 | | `setDate(day)` | নির্দিষ্ট তারিখ সেট করে | 73 | | `setHours(hour)` | নির্দিষ্ট ঘণ্টা সেট করে | 74 | | `setMinutes(min)` | নির্দিষ্ট মিনিট সেট করে | 75 | | `setSeconds(sec)` | নির্দিষ্ট সেকেন্ড সেট করে | 76 | 77 | 🔹 **Example:** 78 | ```js 79 | let myDate = new Date(); 80 | myDate.setFullYear(2030); 81 | myDate.setMonth(5); // June (0-based index) 82 | console.log(myDate); 83 | ``` 84 | 85 | --- 86 | 87 | ## **📌 ৫. Date Comparisons (তারিখ তুলনা করা)** 88 | 🔹 **Example:** 89 | ```js 90 | let date1 = new Date("2025-02-12"); 91 | let date2 = new Date("2025-02-15"); 92 | 93 | if (date1 < date2) { 94 | console.log("date1 is earlier than date2"); 95 | } else { 96 | console.log("date1 is later than date2"); 97 | } 98 | ``` 99 | **✅ Output:** 100 | ``` 101 | date1 is earlier than date2 102 | ``` 103 | 104 | --- 105 | 106 | ## **📌 ৬. Time Methods (সময় বের করা)** 107 | | Method | Description | 108 | |--------|------------| 109 | | `getTime()` | 1970 থেকে বর্তমান সময় পর্যন্ত **মিলিসেকেন্ড** ফেরত দেয় | 110 | | `Date.now()` | বর্তমান Unix Timestamp দেয় | 111 | 112 | 🔹 **Example:** 113 | ```js 114 | let now = new Date(); 115 | console.log(now.getTime()); // 1707734400000 (Milliseconds since 1970) 116 | console.log(Date.now()); // বর্তমান Timestamp 117 | ``` 118 | 119 | --- 120 | 121 | ## **📌 ৭. Countdown Timer (কতদিন বাকি তা বের করা)** 122 | 🔹 **Example:** 123 | ```js 124 | let eventDate = new Date("2025-12-31"); 125 | let today = new Date(); 126 | 127 | let difference = eventDate - today; 128 | let daysLeft = Math.floor(difference / (1000 * 60 * 60 * 24)); 129 | 130 | console.log(`Only ${daysLeft} days left until New Year!`); 131 | ``` 132 | 133 | --- 134 | 135 | ## **📌 ৮. Converting Date to String (তারিখকে স্ট্রিং-এ রূপান্তর করা)** 136 | | Method | Description | Example Output | 137 | |--------|------------|----------------| 138 | | `toDateString()` | শুধুমাত্র তারিখ | `"Wed Feb 12 2025"` | 139 | | `toTimeString()` | শুধুমাত্র সময় | `"14:30:45 GMT+0000"` | 140 | | `toISOString()` | ISO 8601 ফরম্যাট | `"2025-02-12T14:30:45.000Z"` | 141 | 142 | 🔹 **Example:** 143 | ```js 144 | let date = new Date(); 145 | console.log(date.toDateString()); // Wed Feb 12 2025 146 | console.log(date.toTimeString()); // 14:30:45 GMT+0000 147 | console.log(date.toISOString()); // 2025-02-12T14:30:45.000Z 148 | ``` 149 | 150 | --- 151 | 152 | ## **📌 ৯. Local Date Formatting (লোকাল টাইম)** 153 | 🔹 **Example:** 154 | ```js 155 | let date = new Date(); 156 | console.log(date.toLocaleDateString("en-US")); // 2/12/2025 157 | console.log(date.toLocaleDateString("bn-BD")); // ১২/২/২০২৫ 158 | ``` 159 | 160 | --- 161 | 162 | ## **📌 ১০. Stopwatch (Execution Time Check)** 163 | 🔹 **Example:** 164 | ```js 165 | let start = Date.now(); 166 | for (let i = 0; i < 1000000; i++) {} // Loop for delay 167 | let end = Date.now(); 168 | 169 | console.log(`Execution Time: ${end - start} ms`); 170 | ``` 171 | 172 | --- 173 | 174 | ## **🔥 উপসংহার** 175 | ✅ JavaScript-এর **Date Object** ব্যবহার করে **তারিখ ও সময়** নিয়ন্ত্রণ করা যায়। 176 | ✅ **Date Formatting**, **Countdown Timer**, এবং **Execution Time Calculation** করা সম্ভব। 177 | ✅ `toLocaleDateString()` ব্যবহার করে **লোকাল টাইম ফরম্যাট** সেট করা যায়। 178 | -------------------------------------------------------------------------------- /F. Function/Math.md: -------------------------------------------------------------------------------- 1 | # 🚀 **JavaScript Math: Full Guide with Examples** 2 | 3 | JavaScript-এর **Math Object** ব্যবহার করে **সংখ্যার গণনা, রাউন্ডিং, র্যান্ডম সংখ্যা তৈরি, এবং ম্যাথমেটিক্যাল অপারেশন** করা যায়। এটি একটি **built-in object**, তাই আমরা এটি **direct ব্যবহার** করতে পারি। 4 | 5 | --- 6 | 7 | ## **📌 ১. Math Properties (গণিত বিষয়ক কনস্ট্যান্টস)** 8 | JavaScript-এ কিছু **Math Properties** আছে, যা বিভিন্ন কনস্ট্যান্ট মান ধারণ করে: 9 | 10 | | Property | Value | Description | 11 | |-----------------|------------------------|--------------------------------------| 12 | | `Math.PI` | `3.141592653589793` | π (Pi) | 13 | | `Math.E` | `2.718281828459045` | Euler’s number | 14 | | `Math.SQRT2` | `1.4142135623730951` | √2 (Square root of 2) | 15 | | `Math.SQRT1_2` | `0.7071067811865476` | √(1/2) | 16 | | `Math.LN2` | `0.6931471805599453` | Natural log of 2 | 17 | | `Math.LN10` | `2.302585092994046` | Natural log of 10 | 18 | 19 | 🔹 **Example:** 20 | ```js 21 | console.log(Math.PI); // 3.141592653589793 22 | console.log(Math.E); // 2.718281828459045 23 | ``` 24 | 25 | --- 26 | 27 | ## **📌 ২. Number Rounding Methods (সংখ্যা রাউন্ড করা)** 28 | | Method | Description | Example (`x = 4.7`) | 29 | |--------------|--------------------------------|----------------| 30 | | `Math.round(x)` | কাছের পূর্ণসংখ্যায় রাউন্ড করে | `5` | 31 | | `Math.floor(x)` | নিচের দিকে রাউন্ড করে | `4` | 32 | | `Math.ceil(x)` | উপরের দিকে রাউন্ড করে | `5` | 33 | | `Math.trunc(x)` | দশমিক বাদ দিয়ে শুধু পূর্ণসংখ্যা নেয় | `4` | 34 | 35 | 🔹 **Example:** 36 | ```js 37 | console.log(Math.round(4.7)); // 5 38 | console.log(Math.floor(4.7)); // 4 39 | console.log(Math.ceil(4.1)); // 5 40 | console.log(Math.trunc(4.9)); // 4 41 | ``` 42 | 43 | --- 44 | 45 | ## **📌 ৩. Power, Square Root & Logarithm** 46 | | Method | Description | Example | 47 | |--------------------|--------------------------------|---------| 48 | | `Math.pow(x, y)` | `x` এর `y` ঘাত (power) নির্ণয় করে | `Math.pow(2, 3) → 8` | 49 | | `Math.sqrt(x)` | `x`-এর বর্গমূল (square root) বের করে | `Math.sqrt(25) → 5` | 50 | | `Math.cbrt(x)` | `x`-এর ঘনমূল (cube root) বের করে | `Math.cbrt(27) → 3` | 51 | | `Math.log(x)` | `x`-এর প্রাকৃতিক লগারিদম (ln x) | `Math.log(10) → 2.30` | 52 | | `Math.log10(x)` | `x`-এর base 10 লগারিদম | `Math.log10(100) → 2` | 53 | 54 | 🔹 **Example:** 55 | ```js 56 | console.log(Math.pow(2, 3)); // 8 57 | console.log(Math.sqrt(25)); // 5 58 | console.log(Math.cbrt(27)); // 3 59 | console.log(Math.log10(100)); // 2 60 | ``` 61 | 62 | --- 63 | 64 | ## **📌 ৪. Min, Max & Random Numbers** 65 | | Method | Description | Example | 66 | |----------------|----------------------------------|---------| 67 | | `Math.min(a, b, c, ...)` | ছোটতম সংখ্যা বের করে | `Math.min(5, 3, 9) → 3` | 68 | | `Math.max(a, b, c, ...)` | বড়তম সংখ্যা বের করে | `Math.max(5, 3, 9) → 9` | 69 | | `Math.random()` | ০ থেকে ১-এর মধ্যে র্যান্ডম সংখ্যা তৈরি করে | `Math.random() → 0.458` | 70 | 71 | 🔹 **Example:** 72 | ```js 73 | console.log(Math.min(5, 3, 9)); // 3 74 | console.log(Math.max(5, 3, 9)); // 9 75 | console.log(Math.random()); // 0.125374 (random) 76 | ``` 77 | 78 | 🔹 **Random সংখ্যা 1 থেকে 100 এর মধ্যে আনতে:** 79 | ```js 80 | console.log(Math.floor(Math.random() * 100) + 1); 81 | ``` 82 | 83 | --- 84 | 85 | ## **📌 ৫. Trigonometric Methods (ত্রিকোণমিতি ফাংশন)** 86 | | Method | Description | Example | 87 | |--------------|--------------------------------|---------| 88 | | `Math.sin(x)` | `x` রেডিয়ান এর sine মান নির্ণয় করে | `Math.sin(0) → 0` | 89 | | `Math.cos(x)` | `x` রেডিয়ান এর cosine মান নির্ণয় করে | `Math.cos(0) → 1` | 90 | | `Math.tan(x)` | `x` রেডিয়ান এর tangent মান নির্ণয় করে | `Math.tan(0) → 0` | 91 | | `Math.asin(x)` | `x`-এর sine এর বিপরীত মান দেয় (radians) | `Math.asin(1) → 1.57` | 92 | 93 | 🔹 **Example:** 94 | ```js 95 | console.log(Math.sin(0)); // 0 96 | console.log(Math.cos(0)); // 1 97 | console.log(Math.tan(0)); // 0 98 | console.log(Math.asin(1)); // 1.5707963267948966 (π/2 radians) 99 | ``` 100 | 101 | --- 102 | 103 | ## **📌 ৬. Absolute & Sign Methods** 104 | | Method | Description | Example | 105 | |--------------|--------------------------------|---------| 106 | | `Math.abs(x)` | `x`-এর Absolute (ধনাত্মক) মান দেয় | `Math.abs(-10) → 10` | 107 | | `Math.sign(x)` | সংখ্যা ধনাত্মক (+1), ঋণাত্মক (-1) বা 0 তা বলে | `Math.sign(-5) → -1` | 108 | 109 | 🔹 **Example:** 110 | ```js 111 | console.log(Math.abs(-10)); // 10 112 | console.log(Math.sign(-5)); // -1 113 | console.log(Math.sign(5)); // 1 114 | console.log(Math.sign(0)); // 0 115 | ``` 116 | 117 | --- 118 | 119 | ## **📌 ৭. Exponential & Logarithmic Methods** 120 | | Method | Description | Example | 121 | |--------------|--------------------------------|---------| 122 | | `Math.exp(x)` | `e^x` (Euler’s Number এর power x) | `Math.exp(2) → 7.389` | 123 | | `Math.log(x)` | `x` এর প্রাকৃতিক লগারিদম (ln x) | `Math.log(10) → 2.30` | 124 | | `Math.log2(x)` | `x`-এর base 2 লগারিদম | `Math.log2(8) → 3` | 125 | 126 | 🔹 **Example:** 127 | ```js 128 | console.log(Math.exp(2)); // 7.389 129 | console.log(Math.log(10)); // 2.302 130 | console.log(Math.log2(8)); // 3 131 | ``` 132 | 133 | --- 134 | 135 | ## **🔥 উপসংহার** 136 | ✅ JavaScript-এর `Math` object ব্যবহার করে বিভিন্ন **গাণিতিক অপারেশন** করা যায়। 137 | ✅ **`Math.random()`** ব্যবহার করে **random সংখ্যা তৈরি** করা সম্ভব। 138 | ✅ **`Math.round()`, `Math.floor()`, `Math.ceil()`** সংখ্যা রাউন্ডিং করতে ব্যবহৃত হয়। 139 | ✅ **Exponential, Logarithmic, Trigonometric** ফাংশনগুলো গণিত-সংক্রান্ত কাজে ব্যবহৃত হয়। 140 | -------------------------------------------------------------------------------- /H. ES6/Array-Method.md: -------------------------------------------------------------------------------- 1 | ### **ES6 এর গুরুত্বপূর্ণ Array Methods এবং তাদের ব্যাখ্যা** 2 | 3 | ES6 (ECMAScript 2015) এবং পরবর্তী আপডেটগুলোতে অ্যারে ম্যানিপুলেশনের জন্য বেশ কিছু শক্তিশালী মেথড যুক্ত হয়েছে। নিচে **প্রয়োজনীয় ও সবচেয়ে ব্যবহৃত** কিছু অ্যারে মেথড ব্যাখ্যা করা হলো: 4 | 5 | --- 6 | 7 | ## **1. `forEach()` – প্রতিটি আইটেমের উপর লুপ চালানো** 8 | এই মেথডটি একটি কলব্যাক ফাংশন চালায় এবং অ্যারেতে থাকা প্রতিটি উপাদানের জন্য একবার করে কাজ করে। 9 | 10 | ```js 11 | const numbers = [1, 2, 3, 4]; 12 | 13 | numbers.forEach(num => { 14 | console.log(num * 2); 15 | }); 16 | // Output: 2, 4, 6, 8 17 | ``` 18 | 19 | --- 20 | 21 | ## **2. `map()` – নতুন অ্যারে তৈরি করা (Transform করা)** 22 | `map()` মেথডটি মূল অ্যারেটিকে পরিবর্তন না করেই নতুন একটি অ্যারে তৈরি করে এবং প্রতিটি উপাদানের উপর নির্দিষ্ট ফাংশন প্রয়োগ করে। 23 | 24 | ```js 25 | const numbers = [1, 2, 3, 4]; 26 | 27 | const squared = numbers.map(num => num ** 2); 28 | console.log(squared); 29 | // Output: [1, 4, 9, 16] 30 | ``` 31 | 32 | --- 33 | 34 | ## **3. `filter()` – নির্দিষ্ট শর্ত অনুযায়ী উপাদান বাছাই** 35 | এই মেথডটি একটি কন্ডিশন অনুযায়ী অ্যারের মধ্যে থাকা উপাদানগুলিকে ফিল্টার করে এবং নতুন অ্যারে তৈরি করে। 36 | 37 | ```js 38 | const numbers = [10, 25, 30, 45, 50]; 39 | 40 | const filteredNumbers = numbers.filter(num => num > 25); 41 | console.log(filteredNumbers); 42 | // Output: [30, 45, 50] 43 | ``` 44 | 45 | --- 46 | 47 | ## **4. `reduce()` – অ্যারেতে সংক্ষিপ্ত হিসাব করা** 48 | এই মেথডটি অ্যারের সব উপাদান একত্র করে একক মানে পরিণত করে (যেমন – যোগফল, গড়, সর্বোচ্চ মান)। 49 | 50 | ```js 51 | const numbers = [1, 2, 3, 4]; 52 | 53 | const sum = numbers.reduce((acc, num) => acc + num, 0); 54 | console.log(sum); 55 | // Output: 10 56 | ``` 57 | > **ব্যাখ্যা:** 58 | > - `acc` (accumulator) = আগের ধাপে যোগফল 59 | > - `num` = বর্তমান উপাদান 60 | > - `0` = শুরুর মান 61 | 62 | --- 63 | 64 | ## **5. `find()` – শর্ত অনুযায়ী প্রথম মিল পাওয়া উপাদান খোঁজা** 65 | এই মেথডটি এমন একটি উপাদান খোঁজে যা নির্দিষ্ট শর্ত পূরণ করে। 66 | 67 | ```js 68 | const numbers = [10, 20, 30, 40]; 69 | 70 | const foundNumber = numbers.find(num => num > 25); 71 | console.log(foundNumber); 72 | // Output: 30 73 | ``` 74 | 75 | --- 76 | 77 | ## **6. `findIndex()` – নির্দিষ্ট উপাদানের ইনডেক্স খুঁজে বের করা** 78 | এই মেথডটি `find()`-এর মতোই কাজ করে, তবে এটি উপাদানের পরিবর্তে **ইনডেক্স** রিটার্ন করে। 79 | 80 | ```js 81 | const numbers = [10, 20, 30, 40]; 82 | 83 | const index = numbers.findIndex(num => num > 25); 84 | console.log(index); 85 | // Output: 2 (30-এর ইনডেক্স) 86 | ``` 87 | 88 | --- 89 | 90 | ## **7. `some()` – কমপক্ষে একটি শর্ত মিললে `true` রিটার্ন করা** 91 | এই মেথডটি চেক করে যে, অ্যারেতে **কমপক্ষে একটি উপাদান** নির্দিষ্ট শর্ত পূরণ করে কি না। 92 | 93 | ```js 94 | const numbers = [1, 2, 3, 4]; 95 | 96 | const hasEven = numbers.some(num => num % 2 === 0); 97 | console.log(hasEven); 98 | // Output: true (কারণ 2, 4 জোড় সংখ্যা) 99 | ``` 100 | 101 | --- 102 | 103 | ## **8. `every()` – সব উপাদান শর্ত পূরণ করলে `true` রিটার্ন করা** 104 | এই মেথডটি `some()`-এর বিপরীত। এখানে অ্যারের **প্রতিটি উপাদান** শর্ত পূরণ করলে `true` রিটার্ন করবে। 105 | 106 | ```js 107 | const numbers = [2, 4, 6, 8]; 108 | 109 | const allEven = numbers.every(num => num % 2 === 0); 110 | console.log(allEven); 111 | // Output: true 112 | ``` 113 | 114 | --- 115 | 116 | ## **9. `sort()` – অ্যারে সাজানো** 117 | এই মেথডটি অ্যারেতে থাকা উপাদানগুলোকে **অ্যালফাবেটিক্যালি বা সংখ্যা অনুযায়ী** সাজায়। 118 | 119 | ```js 120 | const numbers = [30, 10, 50, 20, 40]; 121 | 122 | numbers.sort((a, b) => a - b); 123 | console.log(numbers); 124 | // Output: [10, 20, 30, 40, 50] (Ascending Order) 125 | ``` 126 | > **ব্যাখ্যা:** 127 | > - `a - b` ব্যবহার করলে **Ascending Order (ছোট থেকে বড়)** সাজাবে। 128 | > - `b - a` ব্যবহার করলে **Descending Order (বড় থেকে ছোট)** সাজাবে। 129 | 130 | --- 131 | 132 | ## **10. `reverse()` – অ্যারে উল্টো করে ফেলা** 133 | এই মেথডটি অ্যারের উপাদানগুলোর ক্রম উল্টে দেয়। 134 | 135 | ```js 136 | const numbers = [10, 20, 30, 40]; 137 | 138 | numbers.reverse(); 139 | console.log(numbers); 140 | // Output: [40, 30, 20, 10] 141 | ``` 142 | 143 | --- 144 | 145 | ## **11. `includes()` – নির্দিষ্ট উপাদান অ্যারেতে আছে কি না তা চেক করা** 146 | এই মেথডটি `true` বা `false` রিটার্ন করে। 147 | 148 | ```js 149 | const fruits = ['apple', 'banana', 'mango']; 150 | 151 | console.log(fruits.includes('banana')); // Output: true 152 | console.log(fruits.includes('grape')); // Output: false 153 | ``` 154 | 155 | --- 156 | 157 | ## **12. `concat()` – দুটি বা তার বেশি অ্যারে একত্র করা** 158 | এই মেথডটি অ্যারে মিলে **নতুন অ্যারে** তৈরি করে। 159 | 160 | ```js 161 | const arr1 = [1, 2]; 162 | const arr2 = [3, 4]; 163 | 164 | const newArray = arr1.concat(arr2); 165 | console.log(newArray); 166 | // Output: [1, 2, 3, 4] 167 | ``` 168 | 169 | --- 170 | 171 | ## **13. `join()` – অ্যারেকে স্ট্রিংয়ে রূপান্তর করা** 172 | এই মেথডটি অ্যারেকে স্ট্রিংয়ে পরিবর্তন করে এবং **প্রতিটি উপাদানের মধ্যে নির্দিষ্ট আলাদা চিহ্ন যোগ করে।** 173 | 174 | ```js 175 | const words = ['Hello', 'World']; 176 | 177 | const sentence = words.join(' '); 178 | console.log(sentence); 179 | // Output: "Hello World" 180 | ``` 181 | 182 | --- 183 | 184 | ## **14. `splice()` – অ্যারে থেকে উপাদান মুছে ফেলা বা যোগ করা** 185 | এই মেথডটি নির্দিষ্ট ইনডেক্স থেকে উপাদান **মুছে ফেলে** বা নতুন উপাদান **যোগ করে।** 186 | 187 | ```js 188 | const numbers = [10, 20, 30, 40]; 189 | 190 | numbers.splice(1, 2); // 1নং ইনডেক্স থেকে ২টি এলিমেন্ট মুছে ফেলবে 191 | console.log(numbers); 192 | // Output: [10, 40] 193 | ``` 194 | 195 | --- 196 | 197 | ## **15. `slice()` – অ্যারের নির্দিষ্ট অংশ কপি করা** 198 | এই মেথডটি একটি নির্দিষ্ট অংশ **কপি** করে নতুন অ্যারে তৈরি করে। 199 | 200 | ```js 201 | const numbers = [10, 20, 30, 40, 50]; 202 | 203 | const slicedNumbers = numbers.slice(1, 4); 204 | console.log(slicedNumbers); 205 | // Output: [20, 30, 40] 206 | ``` 207 | 208 | --- 209 | 210 | ## **শেষ কথা** 211 | এই মেথডগুলো **প্রোগ্রামিংয়ে ডাটা ম্যানিপুলেশন** এবং **অ্যারে নিয়ে কাজ করার ক্ষেত্রে** অনেক বেশি গুরুত্বপূর্ণ। -------------------------------------------------------------------------------- /Interview-Question/Github-Question.md: -------------------------------------------------------------------------------- 1 | # 💻 GitHub ভিত্তিক ইন্টারভিউ প্রশ্নোত্তর (জুনিয়র ডেভেলপারদের জন্য) 2 | 3 | নিচে GitHub সম্পর্কে ২০টি গুরুত্বপূর্ণ প্রশ্ন ও উত্তর দেওয়া হলো — প্রতিটি প্রশ্নের সাথে বাংলা ও ইংরেজি ব্যাখ্যা রয়েছে। 4 | 5 | --- 6 | 7 | ### ✅ ১) GitHub কী? (What is GitHub?) 8 | **বাংলায়:** GitHub একটি অনলাইন প্ল্যাটফর্ম যেখানে Git রিপোজিটরি সংরক্ষণ ও শেয়ার করা যায়। 9 | **English:** GitHub is an online platform where Git repositories can be stored and shared. 10 | 11 | --- 12 | 13 | ### ✅ ২) GitHub-এ কীভাবে নতুন রিপোজিটরি তৈরি করবেন? (How do you create a new repository on GitHub?) 14 | **বাংলায়:** GitHub এ লগইন করে “New Repository” বাটনে ক্লিক করে নাম ও বিবরণ দিয়ে রিপোজিটরি তৈরি করা যায়। 15 | **English:** Log in to GitHub, click on “New Repository”, provide a name and description, and create it. 16 | 17 | --- 18 | 19 | ### ✅ ৩) README ফাইল কেন দরকার? (Why is a README file important?) 20 | **বাংলায়:** README ফাইল প্রোজেক্টের পরিচিতি ও ব্যবহারের নির্দেশনা দেয়। 21 | **English:** A README file introduces the project and explains how to use or install it. 22 | 23 | --- 24 | 25 | ### ✅ ৪) GitHub-এ কিভাবে প্রোজেক্ট আপলোড করবেন? (How do you upload a project to GitHub?) 26 | **বাংলায়:** লোকাল প্রজেক্টে Git init করে, add, commit করে তারপর GitHub রিপোজিটরির সাথে যুক্ত করে push করতে হয়। 27 | **English:** Initialize Git locally, add and commit files, link with GitHub repository, and push the code. 28 | 29 | --- 30 | 31 | ### ✅ ৫) GitHub Repo কে কিভাবে public বা private করা যায়? (How can you make a GitHub repository public or private?) 32 | **বাংলায়:** রিপোজিটরি তৈরি করার সময় বা Settings থেকে visibility পরিবর্তন করা যায়। 33 | **English:** You can set visibility while creating the repo or change it later from Settings. 34 | 35 | --- 36 | 37 | ### ✅ ৬) Fork কী? (What is a fork?) 38 | **বাংলায়:** Fork হলো অন্য কারো রিপোজিটরির কপি নিজের GitHub অ্যাকাউন্টে নেওয়া। 39 | **English:** A fork is a copy of someone else’s repository under your GitHub account. 40 | 41 | --- 42 | 43 | ### ✅ ৭) Pull Request কী? (What is a Pull Request?) 44 | **বাংলায়:** Pull Request হল কোড merge করার জন্য করা একটি অনুরোধ যা রিভিউ করা হয়। 45 | **English:** A Pull Request is a request to merge your code into another branch after review. 46 | 47 | --- 48 | 49 | ### ✅ ৮) Issue কী? (What is an issue on GitHub?) 50 | **বাংলায়:** Issue GitHub-এ একটি সমস্যা, বাগ বা ফিচার অনুরোধ রেকর্ড করার জন্য ব্যবহৃত হয়। 51 | **English:** An issue is used to report bugs, suggest features, or track tasks on GitHub. 52 | 53 | --- 54 | 55 | ### ✅ ৯) GitHub-এর কী কী Collaboration ফিচার আছে? (What collaboration features does GitHub offer?) 56 | **বাংলায়:** GitHub এ Pull Request, Issue tracking, Branch protection, এবং Discussion board রয়েছে। 57 | **English:** GitHub offers Pull Requests, Issue tracking, branch protection, and discussion boards. 58 | 59 | --- 60 | 61 | ### ✅ ১০) Contributor কাকে বলে? (Who is a contributor on GitHub?) 62 | **বাংলায়:** যিনি কোনো GitHub প্রোজেক্টে কোড, ডকুমেন্টেশন বা অন্যভাবে অবদান রাখেন। 63 | **English:** A contributor is someone who contributes code, documentation, or other input to a GitHub project. 64 | 65 | --- 66 | 67 | ### ✅ ১১) Star দেওয়া কী বোঝায়? (What does giving a star to a repository mean?) 68 | **বাংলায়:** এটি বোঝায় যে আপনি প্রোজেক্টটি পছন্দ করেছেন বা পরে দেখতে চান। 69 | **English:** It means you like the project or want to bookmark it for later. 70 | 71 | --- 72 | 73 | ### ✅ ১২) Watch ফিচার কী? (What is the watch feature?) 74 | **বাংলায়:** Watch করলে আপনি সেই রিপোজিটরির সব আপডেট বা নোটিফিকেশন পাবেন। 75 | **English:** Watching a repo lets you receive notifications about its updates or changes. 76 | 77 | --- 78 | 79 | ### ✅ ১৩) GitHub Actions কী? (What are GitHub Actions?) 80 | **বাংলায়:** GitHub Actions হল CI/CD সেটআপ করার একটি টুল যা স্বয়ংক্রিয়ভাবে কোড টেস্ট, বিল্ড ও ডিপ্লয় করতে সাহায্য করে। 81 | **English:** GitHub Actions is a CI/CD tool to automatically test, build, and deploy code. 82 | 83 | --- 84 | 85 | ### ✅ ১৪) GitHub Pages কী? (What is GitHub Pages?) 86 | **বাংলায়:** এটি GitHub থেকে সরাসরি ওয়েবসাইট হোস্ট করার একটি সুবিধা। 87 | **English:** GitHub Pages allows you to host a static website directly from a GitHub repository. 88 | 89 | --- 90 | 91 | ### ✅ ১৫) `.github` ডিরেক্টরি কী কাজে লাগে? (What is the purpose of the `.github` directory?) 92 | **বাংলায়:** এতে Issue template, PR template, ও GitHub Actions workflow রাখা যায়। 93 | **English:** It contains issue templates, PR templates, and GitHub Actions workflows. 94 | 95 | --- 96 | 97 | ### ✅ ১৬) GitHub Repository তে Collaborator কীভাবে যুক্ত করবেন? (How to add a collaborator to a GitHub repository?) 98 | **বাংলায়:** রিপোজিটরির Settings → Collaborators & Teams → Invite collaborator থেকে যুক্ত করা যায়। 99 | **English:** Go to Settings → Collaborators & Teams → Invite collaborator. 100 | 101 | --- 102 | 103 | ### ✅ ১৭) GitHub-এ কিভাবে Pull Request Merge করবেন? (How to merge a Pull Request on GitHub?) 104 | **বাংলায়:** PR ওপেন করে review এর পর “Merge Pull Request” বাটন চাপলেই মার্জ হয়ে যায়। 105 | **English:** Open the PR, review it, and click “Merge Pull Request” to complete the merge. 106 | 107 | --- 108 | 109 | ### ✅ ১৮) GitHub এ Branch Protection কী? (What is branch protection in GitHub?) 110 | **বাংলায়:** এটি একটি সিকিউরিটি সেটিং যা কোনো ব্রাঞ্চে সরাসরি push আটকায় ও কোড রিভিউ বাধ্যতামূলক করে। 111 | **English:** It’s a setting to restrict direct pushes and enforce code reviews on a branch. 112 | 113 | --- 114 | 115 | ### ✅ ১৯) Pull Request এ Reviewers অ্যাড করা কেন দরকার? (Why add reviewers in a Pull Request?) 116 | **বাংলায়:** কোড রিভিউয়ের জন্য নির্দিষ্ট ডেভেলপারদের জানানো হয় যাতে তারা কোড যাচাই করে। 117 | **English:** To notify specific developers for reviewing and verifying the code before merging. 118 | 119 | --- 120 | 121 | ### ✅ ২০) GitHub Repo ডিলিট বা আর্কাইভ কীভাবে করবেন? (How to delete or archive a GitHub repository?) 122 | **বাংলায়:** Settings → Danger Zone থেকে আপনি রিপোজিটরি আর্কাইভ বা ডিলিট করতে পারবেন। 123 | **English:** Go to Settings → Danger Zone to archive or delete the repository. 124 | 125 | --- 126 | -------------------------------------------------------------------------------- /G. DOM/Method.md: -------------------------------------------------------------------------------- 1 | ## **📌 JavaScript-এর Top DOM Methods & তাদের ব্যাখ্যা** 2 | DOM (Document Object Model) ম্যানিপুলেশনের জন্য JavaScript-এর কিছু গুরুত্বপূর্ণ মেথড আছে, যা ওয়েবপেজের এলিমেন্ট পরিবর্তন, অ্যাট্রিবিউট আপডেট এবং ইভেন্ট হ্যান্ডলিং সহজ করে তোলে। 3 | 4 | --- 5 | 6 | ## **📌 1. Element Select করার মেথড** 7 | 👉 HTML ডকুমেন্ট থেকে এলিমেন্ট সিলেক্ট করার জন্য এই মেথডগুলো ব্যবহৃত হয়। 8 | 9 | ### **🔹 1. `document.getElementById(id)` - ID দিয়ে এলিমেন্ট খোঁজা** 10 | 👉 নির্দিষ্ট **ID** দ্বারা একটি নির্দিষ্ট এলিমেন্ট পাওয়া যায়। 11 | ```js 12 | let title = document.getElementById("main-title"); 13 | title.innerText = "Updated Title!"; 14 | ``` 15 | ✅ **ব্যাখ্যা:** 16 | এটি `id="main-title"` থাকা এলিমেন্টের টেক্সট পরিবর্তন করবে। 17 | 18 | --- 19 | 20 | ### **🔹 2. `document.getElementsByClassName(className)` - Class দিয়ে খোঁজা** 21 | 👉 নির্দিষ্ট **className** দ্বারা **একাধিক এলিমেন্টের লিস্ট (HTMLCollection)** পাওয়া যায়। 22 | ```js 23 | let items = document.getElementsByClassName("item"); 24 | console.log(items[0].innerText); // প্রথম item এর টেক্সট দেখাবে 25 | ``` 26 | ✅ **ব্যাখ্যা:** 27 | এটি `.item` ক্লাসযুক্ত সব এলিমেন্টকে খুঁজে পাবে এবং প্রথমটির টেক্সট দেখাবে। 28 | 29 | --- 30 | 31 | ### **🔹 3. `document.getElementsByTagName(tagName)` - ট্যাগের মাধ্যমে খোঁজা** 32 | 👉 নির্দিষ্ট **HTML ট্যাগ** অনুযায়ী **একাধিক এলিমেন্ট** পাওয়া যায়। 33 | ```js 34 | let paragraphs = document.getElementsByTagName("p"); 35 | console.log(paragraphs.length); // কতগুলো

আছে তা দেখাবে 36 | ``` 37 | ✅ **ব্যাখ্যা:** 38 | সব `

` ট্যাগ সংগ্রহ করবে এবং কয়টি আছে তা দেখাবে। 39 | 40 | --- 41 | 42 | ### **🔹 4. `document.querySelector(selector)` - CSS Selector দিয়ে একক এলিমেন্ট সিলেক্ট করা** 43 | 👉 **প্রথম মিল খাওয়া এলিমেন্ট** রিটার্ন করে। 44 | ```js 45 | let firstItem = document.querySelector(".item"); 46 | firstItem.style.color = "red"; 47 | ``` 48 | ✅ **ব্যাখ্যা:** 49 | প্রথম `.item` ক্লাসযুক্ত এলিমেন্টকে লাল করে দেবে। 50 | 51 | --- 52 | 53 | ### **🔹 5. `document.querySelectorAll(selector)` - CSS Selector দিয়ে সব এলিমেন্ট সিলেক্ট করা** 54 | 👉 **সব মিল খাওয়া এলিমেন্ট** সংগ্রহ করে। 55 | ```js 56 | let allItems = document.querySelectorAll(".item"); 57 | allItems.forEach(item => item.style.fontWeight = "bold"); 58 | ``` 59 | ✅ **ব্যাখ্যা:** 60 | সব `.item` এলিমেন্টকে বোল্ড করে দেবে। 61 | 62 | --- 63 | 64 | ## **📌 2. Content Manipulation (কনটেন্ট পরিবর্তনের মেথড)** 65 | 66 | ### **🔹 6. `innerText` - শুধুমাত্র টেক্সট পরিবর্তন করা** 67 | ```js 68 | document.getElementById("title").innerText = "New Title!"; 69 | ``` 70 | ✅ **ব্যাখ্যা:** 71 | এটি শুধুমাত্র টেক্সট পরিবর্তন করবে, কিন্তু কোনো HTML ট্যাগ ইনসার্ট করতে পারবে না। 72 | 73 | --- 74 | 75 | ### **🔹 7. `innerHTML` - HTML সহ পরিবর্তন করা** 76 | ```js 77 | document.getElementById("content").innerHTML = "

Updated Content

"; 78 | ``` 79 | ✅ **ব্যাখ্যা:** 80 | এটি **HTML সহ কনটেন্ট পরিবর্তন করতে পারে।** 81 | 82 | --- 83 | 84 | ### **🔹 8. `textContent` - সব টেক্সট পরিবর্তন করা (hidden text সহ)** 85 | ```js 86 | document.getElementById("title").textContent = "Updated Text!"; 87 | ``` 88 | ✅ **ব্যাখ্যা:** 89 | 👉 `innerText` এর মতোই, তবে এটি **hidden text**-ও পরিবর্তন করতে পারে। 90 | 91 | --- 92 | 93 | ## **📌 3. Attribute Manipulation (অ্যাট্রিবিউট পরিবর্তনের মেথড)** 94 | 95 | ### **🔹 9. `setAttribute(attribute, value)` - নতুন অ্যাট্রিবিউট যোগ বা পরিবর্তন করা** 96 | ```js 97 | document.getElementById("image").setAttribute("src", "new-image.jpg"); 98 | ``` 99 | ✅ **ব্যাখ্যা:** 100 | 👉 `src` পরিবর্তন করে **নতুন ইমেজ সেট করবে**। 101 | 102 | --- 103 | 104 | ### **🔹 10. `getAttribute(attribute)` - নির্দিষ্ট অ্যাট্রিবিউটের মান পাওয়া** 105 | ```js 106 | let link = document.getElementById("myLink"); 107 | console.log(link.getAttribute("href")); // লিংকের URL দেখাবে 108 | ``` 109 | ✅ **ব্যাখ্যা:** 110 | 👉 `href` এর মান দেখাবে। 111 | 112 | --- 113 | 114 | ### **🔹 11. `removeAttribute(attribute)` - অ্যাট্রিবিউট রিমুভ করা** 115 | ```js 116 | document.getElementById("image").removeAttribute("alt"); 117 | ``` 118 | ✅ **ব্যাখ্যা:** 119 | 👉 **alt অ্যাট্রিবিউট রিমুভ করবে।** 120 | 121 | --- 122 | 123 | ## **📌 4. Adding & Removing Elements (নতুন এলিমেন্ট যোগ বা ডিলিট করার মেথড)** 124 | 125 | ### **🔹 12. `createElement(tagName)` - নতুন এলিমেন্ট তৈরি করা** 126 | ```js 127 | let newDiv = document.createElement("div"); 128 | newDiv.innerText = "This is a new div!"; 129 | document.body.appendChild(newDiv); 130 | ``` 131 | ✅ **ব্যাখ্যা:** 132 | 👉 এটি নতুন `
` তৈরি করে **body তে যোগ করবে**। 133 | 134 | --- 135 | 136 | ### **🔹 13. `appendChild(newElement)` - একটি এলিমেন্টে নতুন এলিমেন্ট যোগ করা** 137 | ```js 138 | let ul = document.getElementById("list"); 139 | let newItem = document.createElement("li"); 140 | newItem.innerText = "New List Item"; 141 | ul.appendChild(newItem); 142 | ``` 143 | ✅ **ব্যাখ্যা:** 144 | 👉 `