Repository navigation
Expand file tree
/
Copy pathcourses.json
More file actions
92 lines (92 loc) · 50.6 KB
/
Copy pathcourses.json
File metadata and controls
92 lines (92 loc) · 50.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
[
{
"_id": "69f352a2f238174853b34365",
"title": "C++ Masterclass",
"description": "Learn C++ from scratch.",
"category": "C++",
"notes": [
"# **C++ Masterclass: Complete Notes**\n\nWelcome to the complete C++ guide outlining core language features.",
"## **1. Variables & Operators**\nVariables store data, while operators perform operations.\n```cpp\n#include <iostream>\nusing namespace std;\n\nint main() {\n int age = 25; // Variable\n int nextYear = age + 1; // + is an arithmetic operator\n \n // Logical and Relational\n bool isAdult = (age >= 18) && (nextYear > age);\n \n cout << \"Age: \" << age << \"\\n\";\n return 0;\n}\n```",
"## **2. If-Else Statements**\nUsed for control flow and decision making based on boolean logic.\n```cpp\nint score = 85;\nif (score >= 90) {\n cout << \"A Grade\";\n} else if (score >= 80) {\n cout << \"B Grade\";\n} else {\n cout << \"C Grade\";\n}\n```",
"## **3. Loops (For, While, Do-While)**\nLoops execute a block of code repeatedly as long as a condition is met.\n```cpp\n// For Loop (ideal when exact iterations are known)\nfor(int i = 0; i < 3; i++) {\n cout << i << \" \";\n}\n\n// While Loop (ideal for condition-based stopping)\nint j = 0;\nwhile(j < 3) {\n cout << j << \" \";\n j++;\n}\n\n// Do-While Loop (Executes code at least once!)\nint k = 0;\ndo {\n cout << k << \" \";\n k++;\n} while(k < 3);\n```",
"## **4. Arrays**\nFixed-size sequential collections of elements of the same type stored contiguously in memory.\n```cpp\nint numbers[5] = {10, 20, 30, 40, 50};\ncout << \"First Element: \" << numbers[0]; // Prints 10\n\n// Iterating through the array\nfor(int i = 0; i < 5; i++) {\n cout << numbers[i] << \" \";\n}\n```",
"## **5. Vectors (Dynamic Arrays)**\nThe modern C++ alternative to raw arrays! Vectors resize dynamically and handle memory safely (requires `<vector>`).\n```cpp\n#include <vector>\n#include <iostream>\n#include <algorithm> // For STL algorithms\nusing namespace std;\n\nint main() {\n // 1. Initialization\n vector<int> v = {10, 20, 30};\n\n // 2. Insertions & Deletions\n v.push_back(40); // Adds 40 to the end, O(1)\n v.pop_back(); // Removes the last element, O(1)\n v.insert(v.begin() + 1, 15); // Inserts 15 at index 1, O(N)\n v.erase(v.begin() + 2); // Erases element at index 2, O(N)\n\n // 3. Traversing\n // Method A: Index based\n for(int i = 0; i < v.size(); i++) cout << v[i] << \" \";\n // Method B: Range-based Loop (Modern C++)\n for(int x : v) cout << x << \" \";\n // Method C: Iterators\n for(auto it = v.begin(); it != v.end(); it++) {\n cout << *it << \" \";\n }\n\n // 4. Common STL Functions\n sort(v.begin(), v.end()); // Ascending sort\n sort(v.rbegin(), v.rend()); // Descending sort\n reverse(v.begin(), v.end()); // Reverses the vector entirely\n}\n```",
"## **6. Maps (Ordered and Unordered)**\nMaps store elements in key-value pairs.\n\n**Ordered Map (`<map>`)**: Uses a Binary Search Tree (Red-Black). Keys are sorted automatically. Operations take `O(log N)`.\n**Unordered Map (`<unordered_map>`)**: Uses a Hash Table. Keys are NOT sorted. Operations take `O(1)` on average!\n```cpp\n#include <map>\n#include <unordered_map>\n#include <iostream>\nusing namespace std;\n\nint main() {\n // Ordered Map (Sorted by Key implicitly)\n map<string, int> ages;\n ages[\"Alice\"] = 28;\n ages[\"Charlie\"] = 40;\n ages[\"Bob\"] = 34; // Will store in order: Alice, Bob, Charlie\n\n // Unordered Map (O(1) Hash Table lookup)\n unordered_map<string, int> fastMap;\n fastMap[\"Data\"] = 100;\n\n // Searching & Retrieving\n if (ages.find(\"Bob\") != ages.end()) {\n cout << \"Bob's age: \" << ages[\"Bob\"] << \"\\n\";\n }\n\n // Traversing a Map\n for (auto const& [key, val] : ages) {\n cout << key << \": \" << val << \"\\n\";\n }\n\n // Deleting\n ages.erase(\"Alice\"); // Removes Alice\n}\n```",
"## **7. Sets**\nCollections of unique elements. Like Maps, there are Ordered and Unordered Sets.\n```cpp\n#include <set>\n#include <iostream>\nusing namespace std;\n\nint main() {\n set<int> bst;\n bst.insert(20);\n bst.insert(10);\n bst.insert(30);\n bst.insert(20); // Ignored, as elements must be unique\n\n // Searching and Presence\n if (bst.find(10) != bst.end()) cout << \"10 is present!\\n\";\n // .count() returns 1 if present in set, 0 if missing\n if (bst.count(30)) cout << \"30 is there!\\n\";\n\n // Deletion\n bst.erase(20); // Removes 20 from set\n\n // Lower & Upper Bound (Only in Ordered Set)\n // lower_bound returns iterator to first element >= val\n auto lb = bst.lower_bound(15); \n // upper_bound returns iterator to first element > val\n auto ub = bst.upper_bound(25);\n\n // Traversing\n // Prints 10 30 in sorted order naturally\n for(auto it = bst.begin(); it != bst.end(); it++) {\n cout << *it << \" \"; \n }\n}\n```",
"## **8. Custom Data Structures (Linked Lists)**\nC++ offers low-level memory access via pointers, making it ideal to build custom data structures like Linked Lists from scratch.\n```cpp\n#include <iostream>\nusing namespace std;\n\n// 1. Structure Definition\nstruct Node {\n int data;\n Node* next;\n \n Node(int val) {\n data = val;\n next = nullptr;\n }\n};\n\n// 2. Traversal\nvoid traverse(Node* head) {\n Node* temp = head;\n while(temp != nullptr) {\n cout << temp->data << \" -> \";\n temp = temp->next;\n }\n cout << \"NULL\\n\";\n}\n\n// 3. Insert Node (at the end)\nvoid insertEnd(Node*& head, int val) {\n Node* newNode = new Node(val);\n if(head == nullptr) {\n head = newNode;\n return;\n }\n Node* temp = head;\n while(temp->next != nullptr) {\n temp = temp->next;\n }\n temp->next = newNode;\n}\n\n// 4. Delete Node (by value)\nvoid deleteNode(Node*& head, int key) {\n if(head == nullptr) return; // Empty List\n \n // If head holds the key\n if(head->data == key) {\n Node* toDelete = head;\n head = head->next;\n delete toDelete; // Crucial in C++ to prevent memory leaks!\n return;\n }\n \n Node* temp = head;\n while(temp->next != nullptr && temp->next->data != key) {\n temp = temp->next;\n }\n \n if(temp->next == nullptr) return; // Key not found\n \n Node* toDelete = temp->next;\n temp->next = temp->next->next;\n delete toDelete;\n}\n\n// 5. Finding the Middle Element (Tortoise & Hare approach)\nNode* getMiddle(Node* head) {\n Node* slow = head;\n Node* fast = head;\n // Fast pointer moves 2x the speed of slow pointer\n while(fast != nullptr && fast->next != nullptr) {\n slow = slow->next;\n fast = fast->next->next;\n }\n return slow; // Will hold middle element\n}\n\nint main() {\n Node* head = nullptr;\n \n insertEnd(head, 10);\n insertEnd(head, 20);\n insertEnd(head, 30);\n insertEnd(head, 40);\n insertEnd(head, 50);\n \n // Outputs: 10 -> 20 -> 30 -> 40 -> 50 -> NULL\n traverse(head); \n \n // Test Middle Access\n Node* mid = getMiddle(head);\n if(mid) cout << \"Middle is: \" << mid->data << \"\\n\";\n \n // Test Deletion\n deleteNode(head, 30);\n traverse(head); // 10 -> 20 -> 40 -> 50 -> NULL\n \n return 0;\n}\n```"
],
"__v": 0,
"createdAt": "2026-04-30T13:01:22.697Z",
"updatedAt": "2026-04-30T13:24:07.362Z"
},
{
"_id": "69f352a2f238174853b34366",
"title": "OOPs with Java",
"description": "Master Object-Oriented programming in Java.",
"category": "Java",
"notes": [
"# **Java & OOP: Complete Notes**\n\nWelcome to the complete Java Object-Oriented Programming guide. Java is an enterprise-level, class-based, object-oriented language.",
"## **1. Variables & Data Types**\nJava is a statically-typed language, meaning all variables must be declared with a type.\n```java\npublic class Main {\n public static void main(String[] args) {\n // Primitive Types\n int age = 25;\n double price = 19.99;\n boolean isActive = true;\n char grade = 'A';\n \n // Reference Type\n String name = \"Alice\";\n \n System.out.println(name + \" is \" + age + \" years old.\");\n }\n}\n```",
"## **2. Control Flow (If-Else & Switch)**\nJava uses curly braces `{}` to define block structures explicitly.\n```java\nint score = 85;\n\nif (score >= 90) {\n System.out.println(\"A Grade\");\n} else if (score >= 80) {\n System.out.println(\"B Grade\");\n} else {\n System.out.println(\"C Grade\");\n}\n\n// Switch Statement\nint day = 3;\nswitch (day) {\n case 1:\n System.out.println(\"Monday\"); break;\n case 3:\n System.out.println(\"Wednesday\"); break;\n default:\n System.out.println(\"Other\");\n}\n```",
"## **3. Loops (For, While, Do-While)**\nLoops execute code repeatedly. Java's syntax is nearly identical to C/C++.\n```java\n// For loop\nfor(int i = 0; i < 3; i++) {\n System.out.print(i + \" \"); // Output: 0 1 2\n}\nSystem.out.println();\n\n// While loop\nint count = 0;\nwhile(count < 3) {\n System.out.print(count + \" \");\n count++;\n}\n\n// Do-While loop (Runs at least once!)\nint j = 0;\ndo {\n System.out.print(j + \" \");\n j++;\n} while(j < 3);\n```",
"## **4. Arrays & ArrayLists**\nStandard Arrays are fixed in size, while `ArrayList` can resize dynamically (like Vectors in C++).\n```java\nimport java.util.ArrayList;\nimport java.util.Collections;\n\npublic class Main {\n public static void main(String[] args) {\n // Static Array\n int[] numbers = {10, 20, 30};\n \n // Dynamic ArrayList\n ArrayList<String> fruits = new ArrayList<>();\n fruits.add(\"Apple\");\n fruits.add(\"Banana\");\n fruits.add(1, \"Mango\"); // Insert at index 1\n \n fruits.remove(\"Apple\"); // Removes \"Apple\"\n \n // Traversing elements\n for(String fruit : fruits) {\n System.out.println(fruit);\n }\n \n // Built-in sorting algorithm natively\n Collections.sort(fruits);\n }\n}\n```",
"## **5. HashMaps (Dictionaries)**\n`HashMap` stores elements in key-value pairs.\n```java\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class Main {\n public static void main(String[] args) {\n HashMap<String, Integer> ages = new HashMap<>();\n \n ages.put(\"Alice\", 28);\n ages.put(\"Bob\", 34);\n \n // Traversing heavily relies on map.entrySet()\n for (Map.Entry<String, Integer> entry : ages.entrySet()) {\n System.out.println(entry.getKey() + \" : \" + entry.getValue());\n }\n }\n}\n```",
"## **6. HashSets**\n`HashSet` stores unique elements implicitly leveraging a HashMap under the hood.\n```java\nimport java.util.HashSet;\n\npublic class Main {\n public static void main(String[] args) {\n HashSet<Integer> uniqueNums = new HashSet<>();\n \n uniqueNums.add(10);\n uniqueNums.add(20);\n uniqueNums.add(10); // Ignored securely\n \n // Searching internally\n if (uniqueNums.contains(20)) {\n System.out.println(\"20 is present!\");\n }\n }\n}\n```",
"## **7. OOP Pillar 1: Encapsulation**\n**Encapsulation** is the mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. It is achieved using varying access modifiers (`private`, `public`, `protected`) to hide internal state and prevent direct unauthorized modification.\n```java\nclass Employee {\n // 1. Private fields (hidden from other classes)\n private String name;\n private double salary;\n\n public Employee(String name) {\n this.name = name;\n this.salary = 50000; // Default secure salary\n }\n\n // 2. Public Getter Method (Read access)\n public double getSalary() {\n return this.salary;\n }\n\n // 3. Public Setter Method (Write access safely controlled)\n public void giveRaise(double amount) {\n if(amount > 0) {\n this.salary += amount;\n } else {\n System.out.println(\"Invalid raise!\");\n }\n }\n}\n\npublic class Main {\n public static void main(String[] args) {\n Employee emp = new Employee(\"John\");\n // emp.salary = 100000; => ERROR: salary has private access\n emp.giveRaise(5000);\n System.out.println(\"Salary is: \" + emp.getSalary());\n }\n}\n```",
"## **8. OOP Pillar 2: Inheritance**\n**Inheritance** enables a new class to absorb the attributes and behavior of an existing class using the `extends` keyword. This establishes an \"IS-A\" relationship, enhancing huge code reusability.\n```java\n// Parent (Superclass)\nclass Vehicle {\n protected String brand = \"Ford\"; // Accessible to subclasses\n \n public void honk() {\n System.out.println(\"Tuut, tuut!\");\n }\n}\n\n// Child (Subclass) inherits from Vehicle\nclass Car extends Vehicle {\n private String modelName = \"Mustang\";\n\n public void showDetails() {\n // Can access inherited parent property directly\n System.out.println(brand + \" \" + modelName);\n }\n}\n\npublic class Main {\n public static void main(String[] args) {\n Car myCar = new Car();\n myCar.honk(); // Inherited naturally from Vehicle class\n myCar.showDetails();\n }\n}\n```",
"## **9. OOP Pillar 3: Polymorphism**\n**Polymorphism** means \"many forms\". It occurs when we have many classes related by inheritance. Java supports **Compile-time Polymorphism** (Method Overloading) and **Runtime Polymorphism** (Method Overriding based on the object's dynamic type).\n```java\nclass Animal {\n public void animalSound() {\n System.out.println(\"The animal makes a sound\");\n }\n}\n\nclass Pig extends Animal {\n // Method Overriding (Same signature as parent)\n @Override\n public void animalSound() {\n System.out.println(\"The pig says: wee wee\");\n }\n}\n\nclass Dog extends Animal {\n @Override\n public void animalSound() {\n System.out.println(\"The dog says: bow wow\");\n }\n}\n\npublic class Main {\n // Compile-time Polymorphism (Method Overloading using different parameters)\n public static int add(int a, int b) { return a + b; }\n public static double add(double a, double b) { return a + b; }\n\n public static void main(String[] args) {\n // RUNTIME POLYMORPHISM (Dynamic Method Dispatch)\n // Parent reference holding child object\n Animal myAnimal = new Animal();\n Animal myPig = new Pig();\n Animal myDog = new Dog();\n \n myAnimal.animalSound(); // Executes Animal's method\n myPig.animalSound(); // Executes Pig's method (Runtime decision)\n myDog.animalSound(); // Executes Dog's method\n }\n}\n```",
"## **10. OOP Pillar 4: Abstraction**\n**Abstraction** hides complex implementation details and shows only the essential operational features of an object. Achieved using **Abstract Classes** (`abstract` keyword, can hold normal and abstract methods) and **Interfaces** (100% abstract contract natively). \n```java\n// 1. ABSTRACT CLASS (Cannot be instantiated directly)\nabstract class Shape {\n // Abstract method (no body, child MUST implement this)\n public abstract void draw(); \n \n // Regular method\n public void sleep() {\n System.out.println(\"Zzz\");\n }\n}\n\nclass Circle extends Shape {\n // Forced to implement the abstract method\n @Override\n public void draw() {\n System.out.println(\"Drawing a circle o\");\n }\n}\n\n// 2. INTERFACE (A contract guaranteeing actions)\ninterface Relocatable {\n void move(int x, int y); // Implicitly public and abstract\n}\n\nclass Rectangle extends Shape implements Relocatable {\n public void draw() {\n System.out.println(\"Drawing a rectangle []\");\n }\n \n public void move(int x, int y) {\n System.out.println(\"Moving to \" + x + \", \" + y);\n }\n}\n\npublic class Main {\n public static void main(String[] args) {\n // Shape myObj = new Shape(); // ERROR: Shape is abstract;\n Shape myCircle = new Circle();\n myCircle.draw();\n myCircle.sleep();\n \n Rectangle rect = new Rectangle();\n rect.move(10, 50);\n }\n}\n```"
],
"__v": 0,
"createdAt": "2026-04-30T13:01:22.699Z",
"updatedAt": "2026-04-30T13:24:08.421Z"
},
{
"_id": "69f352a2f238174853b34367",
"title": "Python",
"description": "Start your programming journey with Python.",
"category": "Python",
"notes": [
"# **Python 101: Complete Notes**\n\nWelcome to the complete Python guide. Python is famous for its elegant, highly readable syntax and rapid development speed.",
"## **1. Variables & Data Types**\nPython variables do not need explicit type declarations. The type is inferred automatically at runtime.\n```python\n# Variables and basic types\nname = \"Alice\" # String\nage = 25 # Integer\nprice = 19.99 # Float\nis_active = True # Boolean\n\n# Dynamic typing in action\nx = 10\nx = \"Now I am a string\"\n\nprint(f\"{name} is {age} years old.\")\n```",
"## **2. Control Flow (If-Else)**\nPython uses indentation (whitespace) to determine block scopes instead of curly braces `{}`.\n```python\nscore = 85\n\nif score >= 90:\n print(\"A Grade\")\nelif score >= 80:\n print(\"B Grade\")\nelse:\n print(\"C Grade\")\n```",
"## **3. Loops (For, While)**\nLoops are simple and intuitive. You often use `range()` to loop a specific number of times.\n```python\n# For loop using range(start, stop, step)\nfor i in range(3):\n print(i, end=\" \") # Output: 0 1 2\n\nprint(\"\") # newline\n\n# While loop\ncount = 0\nwhile count < 3:\n print(count, end=\" \") # Output: 0 1 2\n count += 1\n```",
"## **4. Lists (Dynamic Arrays)**\nLists in Python are dynamic, order-preserved, and can hold mixed variable types in contiguous sequence.\n```python\n# Initialization\nfruits = [\"apple\", \"banana\", \"cherry\"]\n\n# Insertions & Deletions\nfruits.append(\"orange\") # O(1) mostly. Adds to the end\nfruits.insert(1, \"mango\") # O(N). Inserts at index 1\nlast = fruits.pop() # O(1) Removes and returns last element\n\n# Traversing and Indexing\nprint(f\"First fruit: {fruits[0]}\")\n\nfor index, fruit in enumerate(fruits):\n print(f\"{index}: {fruit}\")\n\n# Built-in algorithms\nfruits.sort() # sorts alphabetically directly\nfruits.reverse() # reverses the list in place\n```",
"## **5. Dictionaries (Hash Maps)**\nDictionaries (`dict`) store items in key-value pairs using extremely fast Hash Tables. Keys must be unique.\n```python\nages = {\n \"Alice\": 28,\n \"Bob\": 34\n}\n\n# Insertion & Updates\nages[\"Charlie\"] = 40\n\n# Accessing (safely using .get() to avoid KeyErrors)\nprint(ages.get(\"Alice\", \"Not Found\")) # 28\n\n# Traversing a dictionary effectively\nfor key, value in ages.items():\n print(f\"{key} is {value}\")\n\n# Deletion\ndel ages[\"Alice\"]\n```",
"## **6. Sets**\nSets are unordered collections with no duplicate elements. Great for constant-time complexity `O(1)` membership checks.\n```python\n# Creating a set\nunique_nums = {10, 20, 30}\n\nunique_nums.add(20) # Ignored, 20 is already in the set\n\n# Searching (Membership check natively using `in`)\nif 10 in unique_nums:\n print(\"10 is present!\")\n\n# Exploring math set operations\nset_a = {1, 2, 3}\nset_b = {3, 4, 5}\n\nprint(set_a.union(set_b)) # {1, 2, 3, 4, 5}\nprint(set_a.intersection(set_b)) # {3}\n```",
"## **7. Tuples**\nTuples are identical to lists, but they are **immutable** (they cannot be changed, resized, or modified after creation).\n```python\n# Tuples natively use parentheses\ncoordinates = (45.0, -90.0)\n\n# Destructuring (Unpacking)\nlat, lon = coordinates\nprint(f\"Latitude: {lat}\")\n\n# coordinates[0] = 50.0 => Error! Tuple object does not support item assignment\n```",
"## **8. Functions and Classes (Custom Objects)**\nPython uses `def` for functions and `class` to spin up Object-Oriented layouts like classes.\n```python\n# Function definition with type-hints (Optional)\ndef greet(name: str = \"World\") -> str:\n return f\"Hello, {name}!\"\n\n# Custom Class Structure (OOP)\nclass Node:\n # The __init__ function acts as the Object Constructor\n def __init__(self, data):\n self.data = data\n self.next = None\n\n# Creating Objects\nhead = Node(10)\nhead.next = Node(20)\n\nprint(f\"Head data: {head.data}\")\n```"
],
"__v": 0,
"createdAt": "2026-04-30T13:01:22.699Z",
"updatedAt": "2026-04-30T13:24:08.433Z"
},
{
"_id": "69f352a2f238174853b34368",
"title": "Web Development Bootcamp",
"description": "From DOM to full-stack scaling apps with JS, Node, and React.",
"category": "Web Dev",
"notes": [
"## **HTML**\n\n### **What is HTML**\nHTML (HyperText Markup Language) is the standard markup language used to create and design websites and web applications. It describes the structure of a web page using markup.\n```html\n<h1>Welcome to HTML!</h1>\n<p>This is a markup language.</p>\n```\n\n### **index.html**\nThe `index.html` file is typically the default or homepage of a website. When a user visits a directory on a web server, the server looks for this file to display first.\n```html\n<!-- Linking back to the homepage -->\n<a href=\"index.html\">Go Home</a>\n```\n\n### **HTML Basic Structure**\n```html\n<!DOCTYPE html>\n<html>\n<head>\n <title>Page Title</title>\n</head>\n<body>\n <h1>My First Heading</h1>\n <p>My first paragraph.</p>\n</body>\n</html>\n```\n\n### **Comments**\nComments in HTML are not displayed in the browser. They help document your source code.\n```html\n<!-- This is a comment -->\n```\n\n### **HTML is Not Case Sensitive**\nHTML tags are not case sensitive: `<P>` means the same as `<p>`. However, it is standard practice and highly recommended to use lowercase.\n```html\n<P>Uppercase tag</P>\n<p>Lowercase tag (Recommended)</p>\n```\n\n### **HTML Attributes**\nAttributes provide additional information about HTML elements. They are always specified in the start tag and usually come in name/value pairs like `name=\"value\"`.\n```html\n<input type=\"text\" placeholder=\"Enter name\" required>\n```\n\n### **Heading Tag**\nHeadings are defined with the `<h1>` to `<h6>` tags. `<h1>` defines the most important heading, and `<h6>` the least.\n```html\n<h1>Heading 1</h1>\n<h2>Heading 2</h2>\n```\n\n### **Paragraph Tag**\nThe `<p>` tag defines a paragraph. Browsers automatically add an empty line before and after a paragraph.\n```html\n<p>This is a paragraph.</p>\n```\n\n### **Anchor Tag**\nThe `<a>` tag defines a hyperlink. The `href` attribute specifies the URL.\n```html\n<a href=\"https://example.com\">Visit Example</a>\n```\n\n### **Image Tag**\nThe `<img>` tag is used to embed an image. It is empty, meaning it contains attributes only. `src` and `alt` are required.\n```html\n<img src=\"image.jpg\" alt=\"Description\">\n```\n\n### **br Tag**\nThe `<br>` tag inserts a single line break. It is an empty tag with no end tag.\n```html\n<p>First line<br>Second line</p>\n```\n\n### **Bold, Italic and Underline Tag**\n- `<b>` or `<strong>` for bold text.\n- `<i>` or `<em>` for italic text.\n- `<u>` for underlined text.\n```html\n<b>Bold</b>, <i>Italic</i>, <u>Underline</u>\n```\n\n### **Big and Small Tag**\n- `<big>` defines bigger text (deprecated in HTML5).\n- `<small>` defines smaller text.\n```html\n<small>Small text</small>\n```\n\n### **hr Tag**\nThe `<hr>` tag defines a thematic break, displayed as a horizontal rule.\n```html\n<hr>\n```\n\n### **Subscript and Superscript Tag**\n- `<sub>` defines subscript text.\n- `<sup>` defines superscript text.\n```html\n<p>H<sub>2</sub>O and E=mc<sup>2</sup></p>\n```\n\n### **pre Tag**\nThe `<pre>` tag defines preformatted text. It preserves both spaces and line breaks.\n```html\n<pre>\nLine 1\n Line 2\n</pre>\n```\n\n### **Page Layout Techniques**\nLayouts can be created using semantic HTML5 elements like `<header>`, `<nav>`, `<main>`, `<section>`, `<article>`, `<aside>`, and `<footer>`.\n```html\n<header>Site Logo</header>\n<main>Main Content</main>\n<footer>Copyright Info</footer>\n```\n\n### **section Tag**\nThe `<section>` tag defines a thematic grouping of content, typically with a heading.\n```html\n<section>\n <h2>Latest News</h2>\n <p>Breaking news updates.</p>\n</section>\n```\n\n### **article Tag**\nThe `<article>` tag specifies independent, self-contained content.\n```html\n<article>\n <h2>Blog Post Title</h2>\n <p>Article content goes here...</p>\n</article>\n```\n\n### **aside Tag**\nThe `<aside>` tag defines content aside from the page content (e.g., a sidebar).\n```html\n<aside>\n <h4>Related Links</h4>\n <a href=\"#\">Link 1</a>\n</aside>\n```\n\n### **div Tag**\nThe `<div>` tag is a block-level container used to group other HTML elements, often for styling with CSS.\n```html\n<div class=\"container\">\n <p>Grouped content.</p>\n</div>\n```\n\n### **Block and Inline Element**\n- **Block elements** start on a new line and take up full width (e.g., `<div>`, `<p>`, `<h1>`).\n- **Inline elements** do not start on a new line and only take up necessary width (e.g., `<span>`, `<a>`, `<img>`).\n```html\n<div>Block Element (takes full line)</div>\n<span>Inline Element</span> <span>(stays on same line)</span>\n```\n\n### **span Tag**\nThe `<span>` tag is an inline container used to mark up a part of a text or document.\n```html\n<p>My mother has <span style=\"color:blue\">blue</span> eyes.</p>\n```\n\n### **Unordered and Ordered Lists in HTML**\n- Unordered list (`<ul>`) uses bullet points.\n- Ordered list (`<ol>`) uses numbers or letters.\n```html\n<ul>\n <li>Item 1</li>\n</ul>\n<ol>\n <li>Item A</li>\n</ol>\n```\n\n### **Tables in HTML (Including Caption, thead, tbody, colspan)**\nTables are defined with `<table>`. Rows use `<tr>`, headers use `<th>`, and data cells use `<td>`.\nThe `<caption>` adds a title, `<thead>` groups headers, `<tbody>` groups data, and `colspan` merges columns.\n```html\n<table border=\"1\">\n <caption>Student Grades</caption>\n <thead>\n <tr>\n <th>Name</th>\n <th>Grade</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Alice</td>\n <td>A</td>\n </tr>\n <tr>\n <!-- Colspan example -->\n <td colspan=\"2\">No more students</td>\n </tr>\n </tbody>\n</table>\n```\n\n### **Form in HTML (Including Action, Labels, Checkbox, Select)**\nThe `<form>` tag creates a form. `action` defines where data is sent. `<label>` helps accessibility.\n```html\n<form action=\"/submit-form\">\n <label for=\"username\">Name:</label>\n <input type=\"text\" id=\"username\" name=\"user_name\">\n\n <input type=\"checkbox\" id=\"subscribe\" name=\"newsletter\">\n <label for=\"subscribe\">Subscribe?</label>\n\n <select name=\"gender\">\n <option value=\"male\">Male</option>\n <option value=\"female\">Female</option>\n </select>\n\n <button type=\"submit\">Submit</button>\n</form>\n```\n\n### **Class and ID**\n- `class`: Specifies one or more class names for an element (can be used multiple times).\n- `id`: Specifies a unique ID for an element.\n```html\n<p id=\"unique-paragraph\" class=\"text-bold highlight\">Styled paragraph</p>\n```\n\n### **Textarea**\nThe `<textarea>` tag defines a multi-line text input control.\n```html\n<textarea rows=\"4\" cols=\"50\" placeholder=\"Write a message...\"></textarea>\n```\n\n### **iframe Tag**\nThe `<iframe>` tag specifies an inline frame to embed another document.\n```html\n<iframe src=\"https://example.com\" width=\"500\" height=\"200\"></iframe>\n```\n\n### **Video Tag**\nThe `<video>` tag is used to embed video content.\n```html\n<video controls width=\"400\">\n <source src=\"movie.mp4\" type=\"video/mp4\">\n Your browser does not support the video tag.\n</video>\n```",
"## **CSS**\n\n### **What is CSS**\nCSS (Cascading Style Sheets) is used to style and layout web pages. It dictates how HTML elements should be displayed on screen, paper, or in other media.\n```css\n/* Example CSS Document */\nbody {\n font-family: sans-serif;\n}\n```\n\n### **Basic Syntax**\nA CSS rule consists of a selector and a declaration block.\n```css\nselector {\n property: value;\n}\n```\n\n### **Inline Tag (Style Attribute)**\nInline styles are applied directly to an HTML element using the `style` attribute.\n```html\n<h1 style=\"color: blue;\">Hello World</h1>\n```\n\n### **Style Tag**\nThe `<style>` tag is used to define internal CSS within the `<head>` section of an HTML document.\n```html\n<style>\n body { background-color: linen; }\n</style>\n```\n\n### **Color Property**\nThe `color` property sets the text color of an element.\n```css\np { color: red; }\n```\n\n### **Background Color Property**\nThe `background-color` property sets the background color of an element.\n```css\ndiv { background-color: lightblue; }\n```\n\n### **RGB and Hexadecimal Color Systems**\n- **Hexadecimal:** A 6-digit code representing Red, Green, and Blue (e.g., `#FF0000` for red).\n- **RGB:** Defines color using `rgb(red, green, blue)` values from 0 to 255.\n```css\nh1 { color: #00ff00; }\np { color: rgb(0, 0, 255); }\n```\n\n### **Selectors**\nSelectors are used to \"find\" (or select) the HTML elements you want to style.\n- **Universal Selector (`*`):** Selects all elements. `* { margin: 0; }`\n- **Element Selector:** Selects elements based on the element name. `p { color: blue; }`\n- **Class Selector (`.`):** Selects elements with a specific class. `.highlight { color: yellow; }`\n- **ID Selector (`#`):** Selects a single unique element. `#header { font-size: 24px; }`\n\n### **Text Properties**\n- **`text-align`:** Aligns text (left, right, center, justify).\n- **`text-decoration`:** Adds/removes decorations (underline, none).\n- **`font-weight`:** Sets the thickness of the font (bold, normal).\n- **`font-family`:** Specifies the font for text.\n```css\nh1 {\n text-align: center;\n text-decoration: underline;\n font-weight: bold;\n font-family: Arial, sans-serif;\n}\n```\n\n### **Absolute Units in CSS (Pixels)**\nPixels (`px`) are fixed-size units that do not scale relative to other elements.\n```css\ndiv { width: 300px; }\n```\n\n### **Relative Units in CSS (%, em, rem)**\n- **`%`**: Relative to the parent element.\n- **`em`**: Relative to the font-size of the element.\n- **`rem`**: Relative to the font-size of the root element (`<html>`).\n```css\n.container { width: 50%; }\n.text-em { font-size: 2em; }\n.text-rem { font-size: 1.5rem; }\n```\n\n### **Line Height**\nThe `line-height` property specifies the vertical space between lines of text.\n```css\np { line-height: 1.5; }\n```\n\n### **Text Transform**\nThe `text-transform` property controls the capitalization of text (uppercase, lowercase, capitalize).\n```css\np { text-transform: uppercase; }\n```\n\n### **Box Model in CSS**\nEvery element is a rectangular box consisting of:\n- **Width/Height**: The actual content area.\n- **Padding**: Transparent area around the content.\n- **Border**: A line that goes around the padding and content.\n- **Margin**: Transparent area outside the border.\n```css\ndiv {\n width: 300px;\n height: 200px;\n padding: 10px;\n border: 1px solid black;\n margin: 20px;\n}\n```\n\n### **Display Property**\n- **`inline`**: Element takes up only necessary width, no line breaks (e.g., `<span>`). Width/height cannot be set.\n- **`block`**: Element takes full width, starts on a new line (e.g., `<div>`).\n- **`inline-block`**: Like inline, but allows setting width and height.\n- **`none`**: Completely removes the element from the document layout.\n```css\n.block-box { display: block; }\n.inline-box { display: inline; }\n.hidden-box { display: none; }\n```\n\n### **Visibility**\nThe `visibility` property specifies whether an element is visible or hidden. `visibility: hidden;` hides the element but it still takes up space (unlike `display: none;`).\n```css\n.invisible { visibility: hidden; }\n```\n\n### **Alpha Channel (Opacity 0 to 1)**\nThe `opacity` property sets the transparency level, from `0.0` (fully transparent) to `1.0` (fully opaque).\n```css\ndiv { opacity: 0.5; }\n```\n\n### **Position**\n- **`static`**: Default. Not positioned in any special way.\n- **`relative`**: Positioned relative to its normal position.\n- **`absolute`**: Positioned relative to its closest positioned ancestor.\n- **`fixed`**: Positioned relative to the viewport (stays fixed on scroll).\n- **`sticky`**: Toggles between relative and fixed depending on scroll position.\n```css\n.absolute-box {\n position: absolute;\n top: 50px;\n left: 100px;\n}\n```\n\n### **Z-Index**\nThe `z-index` property specifies the stack order of an element (which element should be placed in front of, or behind, the others).\n```css\ndiv { z-index: 10; }\n```\n\n### **Background Image & Size**\n- **`background-image`**: Sets an image as the background.\n- **`background-size`**: Specifies the size of the background image (e.g., `cover`, `contain`).\n```css\nbody {\n background-image: url('bg.jpg');\n background-size: cover;\n}\n```\n\n### **Flexbox Layout & Model**\nFlexbox makes it easy to design a flexible, responsive layout structure without using floats or positioning.\nThe model consists of a **Flex Container** (the parent) and **Flex Items** (the children).\n```css\n.flex-container {\n display: flex;\n}\n```\n\n### **Flexbox Direction**\nThe `flex-direction` property defines the direction flex items are placed in the container.\n- `row` (default), `row-reverse`, `column`, `column-reverse`.\n```css\n.vertical-layout {\n display: flex;\n flex-direction: column;\n}\n```\n\n### **Properties for Flex Container**\n- **`justify-content`**: Aligns items horizontally (e.g., `center`, `space-between`).\n- **`flex-wrap`**: Specifies whether the items should wrap or not (`nowrap`, `wrap`).\n- **`align-items`**: Aligns items vertically (`center`, `stretch`).\n- **`align-content`**: Modifies the behavior of `flex-wrap`, aligning flex lines.\n```css\n.container {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n}\n```\n\n### **Properties for Flex Item**\n- **`align-self`**: Overrides the container's `align-items` property for a single item.\n- **`flex-grow`**: Specifies how much an item will grow relative to others.\n- **`flex-shrink`**: Specifies how much an item will shrink relative to others.\n```css\n.item {\n flex-grow: 1;\n align-self: flex-end;\n}\n```\n\n### **Media Queries**\nMedia queries allow you to apply CSS styles depending on the device's screen size or features.\n```css\n@media (max-width: 600px) {\n body { background-color: lightblue; }\n}\n```\n\n### **Transitions**\nTransitions allow you to change property values smoothly over a given duration.\n- **`transition-property`**: The CSS property to transition (e.g., `width`, `background-color`).\n- **`transition-duration`**: How long the transition takes.\n- **`transition-timing-function`**: The speed curve (`ease`, `linear`).\n- **`transition-delay`**: Delay before the transition starts.\n- **`transition` (shorthand)**: Combines all the above.\n```css\ndiv {\n transition: width 2s ease-in-out 0.5s;\n}\n```\n\n### **CSS Transform**\nThe `transform` property allows you to visually manipulate elements.\n- **`rotate(deg)`**: Rotates the element.\n- **`scale(x, y)`**: Scales the element larger or smaller.\n- **`translate(x, y)`**: Moves the element from its current position.\n- **`skew(deg, deg)`**: Skews the element along the X and Y axes.\n```css\ndiv { transform: rotate(45deg) scale(1.5) translate(50px, 100px); }\n```\n\n### **Animation Properties**\nAnimations allow an element to gradually change from one style to another.\n- **`animation-name`**: Name of the `@keyframes` to bind to the selector.\n- **`animation-duration`**: How long the animation takes to complete.\n- **`animation-timing-function`**: The speed curve of the animation.\n- **`animation-delay`**: Delay before the animation starts.\n- **`animation-iteration-count`**: Number of times the animation should run (e.g., `infinite`).\n- **`animation-direction`**: Whether the animation should play forwards, backwards, or alternate.\n```css\n.animated-box {\n animation-name: slide;\n animation-duration: 2s;\n animation-iteration-count: infinite;\n}\n```\n\n### **Animation Shorthand**\nThe `animation` property combines all animation properties into one line.\n```css\ndiv {\n animation: mymove 5s linear 2s infinite alternate;\n}\n```\n\n### **% in Animation (@keyframes)**\nKeyframes define the styles at different stages of the animation using percentages (0% is start, 100% is end).\n```css\n@keyframes example {\n 0% { background-color: red; }\n 50% { background-color: yellow; }\n 100% { background-color: green; }\n}\n```",
"## **JavaScript**\n\n### **What is JavaScript**\nJavaScript is a high-level, dynamic, and interpreted programming language primarily used to create interactive and dynamic content on web pages.\n```javascript\n// Example\ndocument.body.innerHTML = \"<h1>Hello JavaScript!</h1>\";\n```\n\n### **console.log**\n`console.log()` is a built-in function used to print output to the web console, heavily used for debugging.\n```javascript\nconsole.log(\"Hello, World!\");\n```\n\n### **Variable Rules**\n- Variable names can contain letters, digits, underscores, and dollar signs.\n- They must begin with a letter, `$`, or `_`.\n- They are case sensitive (`y` and `Y` are different variables).\n- Reserved words (like JavaScript keywords) cannot be used as names.\n```javascript\nlet $my_var1 = \"Valid\";\n```\n\n### **let, const, and var**\n- `var`: Function-scoped, can be re-declared and updated (legacy).\n- `let`: Block-scoped, can be updated but not re-declared.\n- `const`: Block-scoped, cannot be updated or re-declared.\n```javascript\nvar name = \"Alice\";\nlet age = 25;\nconst PI = 3.14159;\n```\n\n### **Data Types**\nPrimitive Data Types include: String, Number, Boolean, Undefined, Null, Symbol, and BigInt. Non-Primitive: Object, Array.\n```javascript\nlet str = \"Hello\"; // String\nlet num = 100; // Number\nlet isTrue = true; // Boolean\nlet x; // Undefined\nlet y = null; // Null\n```\n\n### **Comments in JS**\nComments are ignored by the browser and used to explain code.\n```javascript\n// This is a single-line comment\n\n/*\nThis is a \nmulti-line comment\n*/\n```\n\n### **Operators in JS - Assignment, Comparison, Logical**\n- **Assignment**: `=`, `+=`, `-=`\n- **Comparison**: `==` (loose equality), `===` (strict equality), `!=`, `>`, `<`\n- **Logical**: `&&` (AND), `||` (OR), `!` (NOT)\n```javascript\nlet a = 10;\na += 5; // Assignment (a = 15)\nconsole.log(a === 15); // Comparison (true)\nconsole.log(a > 10 && a < 20); // Logical (true)\n```\n\n### **Conditional Statements**\n`if`, `else if`, and `else` are used to perform different actions based on different conditions.\n```javascript\nlet hour = 10;\nif (hour < 12) {\n console.log(\"Good morning\");\n} else {\n console.log(\"Good afternoon\");\n}\n```\n\n### **Ternary Operator**\nA shorthand for an `if...else` statement.\n```javascript\nlet age = 18;\nlet status = (age >= 18) ? \"Adult\" : \"Minor\";\nconsole.log(status);\n```\n\n### **Loops in JS - for, while, do-while, for-of, for-in**\nLoops are used to execute a block of code multiple times.\n```javascript\n// for loop\nfor (let i = 0; i < 3; i++) { console.log(i); }\n\n// while loop\nlet j = 0;\nwhile (j < 3) { console.log(j); j++; }\n\n// do-while loop\nlet k = 0;\ndo { console.log(k); k++; } while(k < 3);\n\n// for-of (Iterables like Arrays)\nlet arrList = [\"A\", \"B\"];\nfor (let item of arrList) { console.log(item); }\n\n// for-in (Object properties)\nlet obj = { a: 1, b: 2 };\nfor (let key in obj) { console.log(key, obj[key]); }\n```\n\n### **Strings in JS and Their Functions**\nStrings store a series of characters.\n```javascript\nlet text = \"JavaScript\";\nconsole.log(text.length); // 10\n```\n\n### **Template Literals & String Interpolation**\nTemplate literals use backticks (` `) and allow multi-line strings and easy variable interpolation using `${}`.\n```javascript\nlet userName = \"John\";\nlet greeting = `Hello ${userName}, welcome!`;\nconsole.log(greeting);\n```\n\n### **String Methods in JS**\n```javascript\nlet strValue = \" Hello World! \";\n\nconsole.log(strValue.toUpperCase()); // \" HELLO WORLD! \"\nconsole.log(strValue.toLowerCase()); // \" hello world! \"\nconsole.log(strValue.trim()); // \"Hello World!\"\nconsole.log(strValue.slice(2, 7)); // \"Hello\"\nconsole.log(\"Hello\".concat(\" \", \"World\")); // \"Hello World\"\nconsole.log(strValue.replace(\"World\", \"JS\")); // \" Hello JS! \"\nconsole.log(strValue.charAt(2)); // \"H\"\n```\n\n### **Arrays in JS**\nArrays are special variables that can hold more than one value.\n```javascript\nlet fruits = [\"Apple\", \"Banana\", \"Orange\"];\nconsole.log(fruits[0]); // \"Apple\"\n```\n\n### **Array Methods**\n```javascript\nlet arr = [1, 2, 3];\n\narr.push(4); // Adds 4 to end: [1, 2, 3, 4]\narr.pop(); // Removes from end: [1, 2, 3]\narr.unshift(0); // Adds 0 to start: [0, 1, 2, 3]\narr.shift(); // Removes from start: [1, 2, 3]\n\nconsole.log(arr.toString()); // \"1,2,3\"\n\nlet arr2 = arr.concat([4, 5]); // Combines arrays\n\n// slice(start, end) - non-destructive\nlet sliced = arr2.slice(1, 3); // [2, 3]\n\n// splice(start, deleteCount, item1...) - destructive\narr2.splice(1, 1, 99); // Removes 1 item at index 1, adds 99\n```\n\n### **Functions in JS**\nFunctions are blocks of code designed to perform a particular task.\n```javascript\nfunction add(a, b) {\n return a + b;\n}\nconsole.log(add(5, 3)); // 8\n```\n\n### **Arrow Functions**\nA shorter syntax for writing function expressions.\n```javascript\nconst multiply = (a, b) => a * b;\nconsole.log(multiply(4, 2)); // 8\n```\n\n### **forEach Loop in Array**\nExecutes a provided function once for each array element.\n```javascript\nlet nums = [1, 2, 3];\nnums.forEach((num) => console.log(num * 2));\n```\n\n### **Callback Function**\nA function passed into another function as an argument, which is then invoked inside the outer function.\n```javascript\nfunction processData(callback) {\n console.log(\"Processing...\");\n callback();\n}\nprocessData(() => console.log(\"Done!\"));\n```\n\n### **map, filter, reduce**\n```javascript\nlet numbers = [1, 2, 3, 4];\n\n// map: creates a new array populated with the results\nlet doubled = numbers.map(n => n * 2); // [2, 4, 6, 8]\n\n// filter: creates a new array with elements that pass a test\nlet evens = numbers.filter(n => n % 2 === 0); // [2, 4]\n\n// reduce: executes a reducer function resulting in a single value\nlet sum = numbers.reduce((total, n) => total + n, 0); // 10\n```\n\n### **DOM (Document Object Model)**\nThe DOM is a programming interface for web documents, representing the page so programs can change the document structure, style, and content.\n\n### **DOM Manipulation - Selecting with ID, Class, Tag, querySelector**\n```javascript\nlet byId = document.getElementById(\"header\");\nlet byClass = document.getElementsByClassName(\"items\");\nlet byTag = document.getElementsByTagName(\"p\");\n\n// querySelector is more versatile (uses CSS selectors)\nlet firstItem = document.querySelector(\".items\"); \nlet allItems = document.querySelectorAll(\".items\");\n```\n\n### **Properties - tagName, innerText, innerHTML, textContent**\n```javascript\nlet el = document.getElementById(\"myDiv\");\n\nconsole.log(el.tagName); // \"DIV\"\n\n// Gets/sets the visible text\nel.innerText = \"New Text\"; \n\n// Gets/sets the HTML content (can inject tags)\nel.innerHTML = \"<strong>Bold Text</strong>\"; \n\n// Gets/sets all text content, including hidden text\nel.textContent = \"Raw Text content\";\n```\n\n### **Events in JS & Event Handling**\nEvents are \"things\" that happen to HTML elements (like clicks). JavaScript can react to these events.\n\n### **Event Object**\nWhen an event occurs, an event object is passed to the handler containing information about the event.\n```javascript\ndocument.querySelector(\"button\").onclick = function(event) {\n console.log(\"Clicked at coordinates:\", event.clientX, event.clientY);\n};\n```\n\n### **Event Listeners**\nThe modern way to attach event handlers.\n```javascript\nconst btn = document.querySelector(\"#myBtn\");\nbtn.addEventListener(\"click\", () => {\n alert(\"Button was clicked!\");\n});\n```\n\n### **Classes in JS**\nClasses are templates for creating objects.\n```javascript\nclass Person {\n constructor(name) {\n this.name = name;\n }\n greet() {\n console.log(`Hi, I am ${this.name}`);\n }\n}\nconst p = new Person(\"Alice\");\np.greet();\n```\n\n### **Inheritance & super Keyword**\nInheritance allows a class to inherit methods and properties from another class using `extends`. `super` calls the parent's constructor.\n```javascript\nclass Employee extends Person {\n constructor(name, jobTitle) {\n super(name); // Calls Person's constructor\n this.jobTitle = jobTitle;\n }\n}\nconst emp = new Employee(\"Bob\", \"Developer\");\n```\n\n### **Error Handling using try-catch**\n```javascript\ntry {\n let x = y + 1; // y is not defined\n} catch (error) {\n console.log(\"An error occurred:\", error.message);\n} finally {\n console.log(\"This always runs.\");\n}\n```\n\n### **Sync in JS - Synchronous and Asynchronous**\n- **Synchronous**: Executes line by line. Blocking.\n- **Asynchronous**: Can execute in the background. Non-blocking.\n```javascript\nconsole.log(\"1. Sync\");\nsetTimeout(() => console.log(\"3. Async\"), 1000);\nconsole.log(\"2. Sync\");\n```\n\n### **Callbacks & Callback Hell**\nCallbacks are used to handle async operations. Nesting too many callbacks leads to \"Callback Hell\" (Pyramid of Doom), making code hard to read.\n```javascript\nsetTimeout(() => {\n console.log(\"Step 1\");\n setTimeout(() => {\n console.log(\"Step 2\");\n setTimeout(() => {\n console.log(\"Step 3\");\n }, 1000);\n }, 1000);\n}, 1000);\n```\n\n### **Promises**\nPromises represent the eventual completion (or failure) of an asynchronous operation. They resolve \"Callback Hell\".\n```javascript\nlet myPromise = new Promise((resolve, reject) => {\n let success = true;\n if (success) resolve(\"Operation Successful\");\n else reject(\"Operation Failed\");\n});\n\nmyPromise\n .then(result => console.log(result))\n .catch(error => console.log(error));\n```\n\n### **async / await**\nSyntactic sugar over Promises, making async code look synchronous.\n```javascript\nasync function fetchUser() {\n try {\n let response = await fetch('https://api.example.com/user');\n let data = await response.json();\n console.log(data);\n } catch (error) {\n console.error(\"Error fetching user:\", error);\n }\n}\n```\n\n### **IIFE - Immediately Invoked Function Expression**\nA function that runs as soon as it is defined. Useful for avoiding variable hoisting from within blocks and avoiding polluting the global scope.\n```javascript\n(function() {\n console.log(\"This runs immediately!\");\n})();\n\n// Arrow function syntax\n(() => {\n console.log(\"Also runs immediately!\");\n})();\n```"
],
"__v": 0,
"createdAt": "2026-04-30T13:01:22.699Z",
"updatedAt": "2026-04-30T13:24:06.910Z"
},
{
"_id": "69f3592aa81f89102890518f",
"title": "DBMS Mastery",
"description": "Master the fundamentals of Database Management Systems, SQL, and NoSQL databases.",
"category": "Database",
"notes": [
"## **Introduction to DBMS**\n\n### **What is a DBMS?**\nA Database Management System (DBMS) is software designed to store, retrieve, and manage data in databases. It acts as an interface between the database and its users or programs.\n\n### **Key Characteristics**\n- **Data Redundancy:** Minimizes duplication of data.\n- **Data Integrity:** Ensures data remains accurate and consistent.\n- **Data Security:** Controls who can access or modify data.\n\n### **ACID Properties**\nTo ensure reliable transactions, a DBMS follows ACID properties:\n1. **Atomicity:** All or nothing. A transaction either completes fully or not at all.\n2. **Consistency:** Database transitions from one valid state to another.\n3. **Isolation:** Transactions occur independently without interference.\n4. **Durability:** Once committed, data remains saved even during power failure.\n\n```sql\n-- Example of a transaction\nBEGIN TRANSACTION;\nUPDATE Accounts SET Balance = Balance - 100 WHERE ID = 1;\nUPDATE Accounts SET Balance = Balance + 100 WHERE ID = 2;\nCOMMIT;\n```\n",
"## **SQL & Relational Databases**\n\n### **What is SQL?**\nStructured Query Language (SQL) is the standard language for dealing with Relational Databases (RDBMS).\n\n### **Basic SQL Queries**\n```sql\n-- Selecting data\nSELECT name, email FROM users WHERE age > 18;\n\n-- Inserting data\nINSERT INTO courses (title, category) VALUES ('DBMS', 'Database');\n\n-- Updating data\nUPDATE users SET status = 'active' WHERE id = 101;\n\n-- Deleting data\nDELETE FROM logs WHERE created_at < '2023-01-01';\n```\n\n### **JOINs in SQL**\nJOINs are used to combine rows from two or more tables based on a related column.\n- **INNER JOIN:** Returns records that have matching values in both tables.\n- **LEFT JOIN:** Returns all records from the left table, and matched records from the right.\n- **RIGHT JOIN:** Returns all records from the right table, and matched records from the left.\n\n```sql\nSELECT orders.id, customers.name\nFROM orders\nINNER JOIN customers ON orders.customer_id = customers.id;\n```\n",
"## **NoSQL & Modern Databases**\n\n### **What is NoSQL?**\nNoSQL (Not Only SQL) databases are non-relational, distributed, and designed for large-scale data storage. They are flexible and don't require a fixed schema.\n\n### **Types of NoSQL**\n1. **Document-oriented:** Stores data in JSON-like documents (e.g., MongoDB).\n2. **Key-Value pairs:** Stores data as key-value pairs (e.g., Redis).\n3. **Column-family:** Stores data in columns instead of rows (e.g., Cassandra).\n4. **Graph-based:** Focuses on relationships between data points (e.g., Neo4j).\n\n### **MongoDB Example**\nMongoDB uses collections and documents instead of tables and rows.\n```javascript\n// Inserting a document in MongoDB\ndb.users.insertOne({\n name: \"Chandan\",\n role: \"Developer\",\n skills: [\"JS\", \"Node\", \"MongoDB\"]\n});\n\n// Finding a document\ndb.users.find({ role: \"Developer\" });\n```\n\n### **Normalization vs Denormalization**\n- **Normalization:** Reducing redundancy by dividing large tables into smaller ones (ideal for SQL).\n- **Denormalization:** Combining data into single documents to speed up reads (ideal for NoSQL).\n"
],
"createdAt": "2026-04-30T13:29:14.390Z",
"updatedAt": "2026-04-30T13:29:14.390Z",
"__v": 0
}
]