{
  "Introduction and Basics": [
    {
      "title": "JS Introduction",
      "description": "In this module, we are going to kick start the fundamentals of JavaScript and its important role in web dev. We’ll start by discussing very basic question which is one and only 😄 “What is JavaScript“ because first of all we need to know WHAT JAVASCRIPT IS ?",
      "sub_description": "Then we’ll discuss interactive experiences and how the Javascript get executed in browsers.<br>By the end of this module, you will have solid knowledge of JavaScript.",
      "additional_info": "<b>Let's start the journey...🛣️</b>",

      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What is JavaScript?"
        },
        {
          "type": "paragraph",
          "text": "JavaScript is a language that writes the program which is used to add dynamic interactive behaviour inside the websites. It is called scripting language because it executes on the browser."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Key Features of JavaScript:"
        },
        {
          "type": "list",
          "items": [
            "<b>Client-Side:</b> JS usually runs in the browser as mentioned above, means it gets executed on your computer not on the server. This allows website to interact with you in real time.",
            "<b>Dynamic:</b> With JS, we can update style, content, or structure of the website. <br><br> <i>For example, by clicking on the button the text of the paragraph tag get changed, this is best example to understand the dynamic feature of js.</i>",
            "<b>Versatile:</b> Intially, JavaScript was only used for web browser, but now it get used in almost every field like backend dev ( Node Js ) 👨‍💻, mobile apps 📱, desktop apps 🖥️, etc."
          ]
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Role in Web Development"
        },
        {
          "type": "paragraph",
          "text": "JavaScript plays very crucial role in Web dev by enabling the feature like interactivity, making web pages dynamic and animated. The combo of three tech <b>HTML, CSS, JS</b> form the backbone of Web dev. HTML provides the skeleton 💀 (Structure) of the webpage, CSS provides makeup 😄 sorry styling of the webpage and the final stage JavaScript adds the brain, allowing the page to repsond to user input, events, and interactions."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Executing JavaScript: Browser vs Node.js 🤺"
        },
        {
          "type": "paragraph",
          "text": "The method of executing JS from browser are used from centuries just kidding 😁. The browser is the traditional environment to execute the JavaScript. When we execute JS in a browser, it interacts with web page ( created with HTML and makeup 😁 CSS ) and enables dynamic content and user interaction."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "How to execute JS in the browser:"
        },
        {
          "type": "paragraph",
          "text": "We can execute JavaScript in browser mainly using 3 methods,"
        },
        {
          "type": "list",
          "items": [
            "Inline HTML Documents",
            "External JavaScript File",
            "Browser Console"
          ]
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Inline HTML Documents"
        },
        {
          "type": "paragraph",
          "text": "We can write js in HTML file directly by adding the &lt;script&gt; tag."
        },
        {
          "type": "textarea",
          "text": "&lt;!DOCTYPE html&gt;\n&lt;html lang=&quot;en&quot;&gt;\n&lt;body&gt;\n    &lt;h1&gt;Welcome to Webcooks&lt;/h1&gt;\n    &lt;script&gt;\n        alert(&quot;Welcome friends 👯‍♂️&quot;);\n    &lt;/script&gt;\n&lt;/body&gt;\n&lt;/html&gt;"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "External JavaScript File"
        },
        {
          "type": "paragraph",
          "text": "This method is also like a first one the only difference is, <br> We need to <b>create seperate JS file</b> and add that file using &lt;script&gt; tag"
        },
        {
          "type": "paragraph",
          "text": "<b>script.js</b>"
        },
        {
          "type": "textarea",
          "text": "alert(\"Welcome to Webcooks\");"
        },
        {
          "type": "paragraph",
          "text": "<b>index.html</b>"
        },
        {
          "type": "textarea",
          "text": "&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;body&gt;\n    &lt;h1&gt;Welcome&lt;/h1&gt;\n    &lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;\n&lt;/body&gt;\n&lt;/html&gt;"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Browser Console"
        },
        {
          "type": "paragraph",
          "text": "Almost all browser comes with developer tools which includes a JavaScript console where we can execute JS Code"
        },
        {
          "type": "paragraph",
          "text": "<b>To open the console:</b> <br> <b>Google Chrome: </b>Press <i>Ctrl+Shift+J</i> in windows or <i>Cmd+Option+J</i> in MAC OS. We can also open console by two finger click it opens the menu then just select the inspect option in menu."
        },
        {
          "type": "paragraph",
          "text": "Then in console tab we can write our JS Code<br><b>Example</b>"
        },
        {
          "type": "textarea",
          "text": "alert(\"Welcome to webcooks\")"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "How to execute JS in the Node.js:"
        },
        {
          "type": "paragraph",
          "text": "Node.js is a <b>server-side</b> runtime environment for JavaScript. It allows you ro run JS outside the browser like other programming language execution just install the <b>Node.js</b> in your system and create the JS File"
        },
        {
          "type": "paragraph",
          "text": "<b>Example: </b>script1.js"
        },
        {
          "type": "textarea",
          "text": "console.log(\"Welcome to Webcooks\");"
        },
        {
          "type": "paragraph",
          "text": "We can execute above file using terminal:"
        },
        {
          "type": "textarea",
          "text": "node script1.js"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Display Output"
        },
        {
          "type": "paragraph",
          "text": "Our first step to learn every programming language is display or print some message then you can say that \"I am master of programming language let's start applying for a job\" 😅"
        },
        {
          "type": "paragraph",
          "text": "To display the output we have mainly 3 methods,<br> <b>Using console.log()<br>Using alert()<br>Using document.write()</b>"
        },
        {
          "type": "paragraph",
          "text": "I am going to display some awesome things 😎"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Using console.log()"
        },
        {
          "type": "paragraph",
          "text": "The <i>console.log()</i> method is used to display output in developer console."
        },
        {
          "type": "textarea",
          "text": "console.log(\"Hello, Webcooks\")"
        },
        {
          "type": "paragraph",
          "text": "We can see the output in console tab which is inside the inspect element in browser"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Using alert()"
        },
        {
          "type": "paragraph",
          "text": "The alert() method display the output in the form of pop up which display in the browser at top position it also have <b>OK</b> and <b>Cancel</b> button.<br><b>Example:</b> You can write below example in browser's console"
        },
        {
          "type": "textarea",
          "text": "alert(\"Hello, Webcooks\")"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Using document.write()"
        },
        {
          "type": "paragraph",
          "text": "This method writes content straight into the HTML document so that it is rendered at the browser end."
        },
        {
          "type": "textarea",
          "text": "document.write(\"Hello, Webcooks\")"
        },
        {
          "type": "paragraph",
          "text": "Above JS code we need to add into script file or &lt;script&gt; tag."
        }
      ]
    },
    {
      "title": "JS statements and syntax",
      "description": "First of all congratulations 🥳, from my side to successfully completing 1st Module of this chapter",
      "sub_description": "<b>Let's start the another journey...🛣️</b>",
      "additional_info": "In this module, we are going to dive into foundational elements of JavaScript syntax and structure. We'll learn how the JavaScript statements are written and executed, then last but not the least (Famous Dialogue 😁) we'll learn comments in JS",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "Basic Syntax and Statements"
        },
        {
          "type": "paragraph",
          "text": "JavaScript program are made up of series of statments that tells the browser what to do. A statement is simple instruction or command which performs some actions like print the message into console is a task and we can do this task by using statement <b>console.log(\"Hello\")</b> as discussed earlier.<br><br> Similarly, we have different kind of statements available in JS we will discuss that later."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Comments"
        },
        {
          "type": "paragraph",
          "text": "Programmer like you 🫵 write a great code but for writing self explanationary code we need to add some notes or point inside the code. These notes do not affect the execution of your program but help to explain what your code does, making code easier for others to understand."
        },
        {
          "type": "list",
          "items": [
            "<b>Single-line Comments:</b> Used for brief notes",
            "<b>Multi-line Comments:</b> Used for long descriptions"
          ]
        },
        {
          "type": "textarea",
          "text": "// This is single-line comment \n \n/* \n This is multi-line \n \t comment \n*/"
        }
      ]
    },
    {
      "title": "Variables in JavaScript",
      "description": "Congratulations 🥳, from my side to successfully completing 2nd Module of this chapter",
      "sub_description": "<b>Now start another journey with fresh mind like fresh juice 🥤</b>",
      "additional_info": "In this module, we are going to discuss very important concepts of JavaScript or any programming languages <b>which is VARIABLES</b>.<br> So, take your focus at peek level and start this module.",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What is variables in JS?"
        },
        {
          "type": "paragraph",
          "text": "Variables are container like box of sugar in our house 🏠 which is used to store data values. In Javascript, a variable can be thought of as a box of sugar where we can say the sugar is data which is stored by the box."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Declaring the variables:"
        },
        {
          "type": "paragraph",
          "text": "JavaScript provides 3 types of keywords to declare the variables,"
        },
        {
          "type": "paragraph",
          "text": "<b>var:</b> This is the oldest way of declaring variables in JavaScript which is used in the beginning of the JavaScript. var is function scoped. If a variable is declared using var inside a function, it cannot be accessed outside that function. It ignores block scope."
        },
        {
          "type": "textarea",
          "text": "function func() {\n\tvar a = 10;\n}\nconsole.log(a);"
        },
        {
          "type": "paragraph",
          "text": "Here, the <b>a</b> is not accessible because <b>a</b> variable is created inside the function and var is function scoped outside the function the <b>var</b> variables cannot accessed."
        },
        {
          "type": "textarea",
          "text": "if (true){\n\tvar a = 10;\n}\nconsole.log(a);"
        },
        {
          "type": "paragraph",
          "text": "Because the <b>var</b> ignores the block scope that's why here the a variable accessible outside the block of <b>if</b>."
        },
        {
          "type": "paragraph",
          "text": "<b>let:</b> This keyword is introduced in ES6 ( ECMAScript 2015 ), let provides block-scoped variable declarations. let ` is block-scoped: That is, let variables are available only inside the innermost set of `{}` in which they were declared."
        },
        {
          "type": "textarea",
          "text": "if (true) {\n\tlet a = 10;\n}\nconsole.log(a);"
        },
        {
          "type": "paragraph",
          "text": "As we discussed, the variable <b>a</b> with var can accessible outside the block but in the above example because the <b>a</b> variable created using let keyword and it has block scope the <b>a</b> variable cannot be accessed outside the block."
        },
        {
          "type": "paragraph",
          "text": "But we can access the <b>a</b> variable inside the block"
        },
        {
          "type": "textarea",
          "text": "if (true) {\n\tlet a = 10;\n\tconsole.log(a);\n}"
        },
        {
          "type": "paragraph",
          "text": "<b>const:</b> This keyword is also introduced in ES6, const is used for creating a ziddi variable 😁 means variables that not meant to change. In simple way, If we create a variable and assign a value to that variable after that we cannot change the value of the variable through out the program."
        },
        {
          "type": "paragraph",
          "text": "<b>Nahi samje...🤔</b>"
        },
        {
          "type": "paragraph",
          "text": "Roko ✋ <br> Example deta hu.."
        },
        {
          "type": "textarea",
          "text": "const a = 10\na = 11;"
        },
        {
          "type": "paragraph",
          "text": "Above code 🧑‍💻, gives an error because <b>a</b> variable is created using <b>const</b> and the const variable value cannot get changed after once initialized matlab assigned a value."
        },
        {
          "type": "paragraph",
          "text": "<b>Samje Kay..👍</b><br>Teacher hi itna acha hai..🤪"
        }
      ]
    },
    {
      "title": "Datatypes in JavaScript",
      "description": "🎉 Congrats on making it this far!",
      "sub_description": "Time to dive into another cool topic: <b>Data Types in JavaScript!</b>",
      "additional_info": "Let’s jump in with the same excitement as opening a new jar of Nutella 🍫!",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What are Data Types in JavaScript? 🤔"
        },
        {
          "type": "paragraph",
          "text": "Data types are the kind of things you can put in your storage boxes, presumably📦. In JavaScript, each type tells us what kind of data we are working with—whether it's numbers, text, or true/false stuff."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Let’s check out the main types! 👇"
        },
        {
          "type": "paragraph",
          "text": "<b>1. Number:</b> Number is called a Number that why it called a Number 🤣 just kidding guyz.... These are just numbers—plain and simple! Whole numbers, decimals, and even negative numbers all fall under this category."
        },
        {
          "type": "textarea",
          "text": "let age = 18; // Whole Number\nlet pi = 3.14; // decimal number\nlet temp = -10; // negative number",
          "template": "let age = 18; // Whole Number\nlet pi = 3.14; // decimal number\nlet temp = -10; // negative number\nconsole.log(age);console.log(pi);console.log(temp);"
        },
        {
          "type": "paragraph",
          "text": "<b>2. String: </b> Strings are just pieces of text wrapped in quotes, like putting words inside a bubble 🗨️. Use single ' ' or double quotes \" \"—it doesn’t matter!"
        },
        {
          "type": "textarea",
          "text": "let name=\"Webcooks\";\nlet var1 = 'Hello guyz..'",
          "template": "let name=\"Webcooks\";\nlet var1 = 'Hello guyz..'\nconsole.log(name);\nconsole.log(var1);"
        },
        {
          "type": "paragraph",
          "text": "<b>3. Boolean: </b>Booleans are like switches (ting tong 🔔)—they're either ON or OFF, true or false. Perfect for YES or NO answers!"
        },
        {
          "type": "textarea",
          "text": "let isCodingFun = true;\nlet isHomeworkDone = false; 😅",
          "template": "let isCodingFun = true;\nlet isHomeworkDone = false; \nconsole.log(isCodingFun);\nconsole.log(isHomeworkDone);"
        },
        {
          "type": "paragraph",
          "text": "<b>4. Undefined: </b>This one’s like an (Debba 📦) empty box you haven’t filled yet. A variable declared without a value is said to be undefined."
        },
        {
          "type": "textarea",
          "text": "let myFuture;\nconsole.log(myFuture); // Undefined"
        },
        {
          "type": "paragraph",
          "text": "<b>5. Null: </b>Null is like saying, “Yep, this box is EMPTY, and I’m okay with that!” 😎 It’s a way to clear out a value on purpose."
        },
        {
          "type": "textarea",
          "text": "let noValue = null;\nconsole.log(noValue); // null"
        },
        {
          "type": "paragraph",
          "text": "<b>6. Object: </b>An object is a big bucket where various kinds of data get held together.It's a big vessel with one roof, storing the varieties of data. Think of it like a suitcase with many labeled pockets 🧳."
        },
        {
          "type": "textarea",
          "text": "let organization = {\n\tname: \"Webcooks\",\n\tage: 30,\n\tisInstitute: true\n};",
          "template": "let organization = {\n\tname: \"Webcooks\",\n\tage: 30,\n\tisInstitute: true\n};\nconsole.log(organization);"
        },
        {
          "type": "paragraph",
          "text": "<b>7. Array: </b>An array is like a shopping list 🛒 for data. It’s a collection of items, all neatly ordered and wrapped in square brackets []."
        },
        {
          "type": "textarea",
          "text": "let shoppingList = [\"Apples\", \"Bananas\", \"Milk\", \"Chocolate\";",
          "template": "let shoppingList = [\"Apples\", \"Bananas\", \"Milk\", \"Chocolate\"];\nconsole.log(shoppingList);"
        },
        {
          "type": "paragraph",
          "text": "That's it! You've unlocked another JavaScript secret 🔑!"
        }
      ]
    },
    {
      "title": "Type Conversion in JavaScript",
      "description": "🎉Whoop whoop! You’re moving fast",
      "sub_description": "It’s time for another exciting topic — <b>Type Conversion in JavaScript!</b>",
      "additional_info": "It’s like changing your clothes to fit the weather 🌦️, but here, we’re changing data to fit what we need! 😎",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What is Type Conversion? 🤔"
        },
        {
          "type": "paragraph",
          "text": "Type conversion is when we change data from one type to another. It’s like taking a number and turning it into a string, or grabbing a string and turning it into a number. Basically, it’s a little magic trick 🎩✨ JavaScript does for us."
        },
        {
          "type": "paragraph",
          "text": "We have two types of conversions in JavaScript: Implicit (JavaScript does it automatically) and Explicit (we do it ourselves)."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Implicit Conversion (Automatic) 🧙‍♂️"
        },
        {
          "type": "paragraph",
          "text": "JavaScript is a smart cookie 🍪. Sometimes, it tries to guess what you want and automatically converts data types behind the scenes. This is called implicit conversion."
        },
        {
          "type": "paragraph",
          "text": "<b>Example 1: String + Number = String</b>"
        },
        {
          "type": "paragraph",
          "text": "If you add a string and a number, JavaScript thinks, “Okay, you must want a string!” So, it converts the number to a string."
        },
        {
          "type": "textarea",
          "text": "let result = \"The answer is: \" + 42;\nconsole.log(result); // \"The answer is: 42\""
        },
        {
          "type": "paragraph",
          "text": "<b>Example 2: Number + String = String</b>"
        },
        {
          "type": "paragraph",
          "text": "Even if you start with a number, if a string is in the mix, it all becomes a string!"
        },
        {
          "type": "textarea",
          "text": "let result = 5 + \"5\";\nconsole.log(result); // \"55\""
        },
        {
          "type": "paragraph",
          "text": "<b>Example 3: Number + Boolean</b>"
        },
        {
          "type": "paragraph",
          "text": "If you add a number and a true, JavaScript treats true as 1."
        },
        {
          "type": "textarea",
          "text": "let sum = 10 + true;\nconsole.log(sum); // 11"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Explicit Conversion (Manual) 🛠️"
        },
        {
          "type": "paragraph",
          "text": "Sometimes, we want to be the boss and do the conversion ourselves. This is called explicit conversion."
        },
        {
          "type": "paragraph",
          "text": "<b>1. Converting to a String 📜</b>"
        },
        {
          "type": "paragraph",
          "text": "Want to turn a number into a string? Easy! Use <i>String()</i> or <i>.toString()</i>."
        },
        {
          "type": "textarea",
          "text": "let num = 123;\nlet str = String(num); // \"123\"\nconsole.log(str);"
        },
        {
          "type": "paragraph",
          "text": "<b>2. Converting to a Number 🔢</b>"
        },
        {
          "type": "paragraph",
          "text": "Need to turn a string into a number? No problem! Use <i>Number()</i> or <i>parseInt()</i> for whole numbers and parseFloat() for decimals."
        },
        {
          "type": "textarea",
          "text": "let str = \"456\";\nlet num = Number(str); // 456\nconsole.log(num);"
        },
        {
          "type": "paragraph",
          "text": "<b>3. Converting to a Boolean 💡</b>"
        },
        {
          "type": "paragraph",
          "text": "Any value can be turned into a boolean using Boolean(). Keep in mind: 0, \"\" (empty string), null, undefined, and NaN become false. Everything else is true."
        },
        {
          "type": "textarea",
          "text": "let str = \"Hello\";\nlet isTruthy = Boolean(str); // true\nconsole.log(isTruthy);"
        },
        {
          "type": "paragraph",
          "text": "Because JavaScript’s auto-conversions can surprise you! 😲 Knowing how it works helps you avoid unexpected bugs and keep your code clean."
        }
      ]
    },
    {
      "title": "Operators in JavaScript",
      "description": "Alright, buckle up! 🚀",
      "sub_description": "It’s time to explore the <b>Operators</b> in JavaScript",
      "additional_info": "They’re like the tools in our coding toolbox 🧰, Operators in JavaScript let us perform a variety of tasks. Let's go over some in a quick and easy way🤓: ",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "1. Arithmetic Operators 🔢"
        },
        {
          "type": "paragraph",
          "text": "These are your go-to tools for doing math—just like the buttons on a calculator!"
        },
        {
          "type": "list",
          "items": [
            "<b>+ (Addition): </b>Adds two numbers together.<br>Example: 5 + 3 gives 8. 🎉",
            "<b>- (Subtraction): </b>Subtracts one number from another.<br>Example: 10 - 4 gives 6. 🙃",
            "<b>* (Multiplication): </b>Multiplies numbers.<br>Example: 2 * 5 gives 10. 💪",
            "<b>/ (Division): </b>Divides one number by another.<br>Example: 20 / 4 gives 5. 🎯",
            "<b>% (Modulus): </b>Gives the remainder after division.<br>Example: 10 % 3 gives 1. 📏",
            "<b>++ (Increment): </b>Adds 1 to a number.<br>Example: let x = 5; x++ changes x to 6. 🚀",
            "<b>-- (Decrement): </b>Subtracts 1 from a number.<br>Example: let y = 3; y-- changes y to 2. 😎"
          ]
        },
        {
          "type": "textarea",
          "text": "let a = 10;\nlet b = 3;\nconsole.log(a + b); // 13\nconsole.log(a - b); // 7\nconsole.log(a * b); // 30\nconsole.log(a / b); // 3.333...\nconsole.log(a % b); // 1"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "2. Assignment Operators 📝"
        },
        {
          "type": "paragraph",
          "text": "These operators are like saying, “Hey, put this value in that variable!” 🎯"
        },
        {
          "type": "list",
          "items": [
            "<b>=: </b>Basic assignment. Puts a value into a variable.<br>Example: let x = 10 sets x to 10.",

            "<b>+=: </b>Adds a value to a variable.<br>Example: x += 5 is like x = x + 5. If x was 10, now it’s 15.",

            "<b>-=: </b>Subtracts a value from a variable.<br>Example: x -= 3 is like x = x - 3. If x was 15, now it’s 12.",

            "<b>*=: </b>Multiplies a variable by a value.<br>Example: x *= 2 is like x = x * 2. If x was 12, now it’s 24.",

            "<b>/=: </b>Divides a variable by a value.<br>Example: x /= 4 is like x = x / 4. If x was 24, now it’s 6.",

            "<b>%=: </b>Calculates the remainder of a division and assigns it to a variable.<br>Example: x %= 5 is like x = x % 5. If x was 6, now it’s 1."
          ]
        },
        {
          "type": "textarea",
          "text": "let x = 10;\nx += 5; // Now x is 15\nx -= 3; // Now x is 12\nx *= 2; // Now x is 24\nx /= 4; // Now x is 6\nx %= 5; // Now x is 1",
          "template": "let x = 10;\nconsole.log(x);\nx += 5; // Now x is 15\nconsole.log(x);\nx -= 3; // Now x is 12\nconsole.log(x);\nx *= 2; // Now x is 24\nconsole.log(x);\nx /= 4; // Now x is 6\nconsole.log(x);\nx %= 5; // Now x is 1\nconsole.log(x);"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "3. Comparison Operators 🤔"
        },
        {
          "type": "paragraph",
          "text": "These are like the judges of JavaScript—they compare things and tell you if it's true or false. 📜"
        },
        {
          "type": "list",
          "items": [
            "<b>== (Equal to): </b>Checks if values are the same (ignores type).<br>Example: 5 == '5' is true.",

            "<b>=== (Strictly Equal to): </b>Compares both value and type. Example: 5 === '5' will be false because one is a number and the other is a string.<br>Example: 5 === '5' is false (because one is a number and the other is a string).",

            "<b>!= (Not equal to): </b>Checks if values are different.<br>Example: 5 != 4 is true.",

            "<b>!== (Strictly Not Equal to): </b>Checks if values or types are not the same.<br>Example: 5 !== '5' is true (because their types differ).",

            "<b>> (Greater than): </b>It is TRUE if one number is bigger than another.<br>Example: 7 > 5 is true.",

            "<b>< (Less than): </b>Checks if one value is smaller than another.<br>Example: 3 < 6 is true.",

            "<b>>= (Greater than or equal to): </b> Checks whether one value is greater or equal to another.<br>For instance, 5 >= 5 is true.",

            "<b><= (Less than or equal to): </b> Comparers whether one number is smaller or the same size as another.<br>Example: 4 <= 5 is true."
          ]
        },
        {
          "type": "textarea",
          "text": "let a = 10;\nlet b = \"10\";\nconsole.log(a == b);  // true (only compares values)\nconsole.log(a === b); // false (compares value & type)\nconsole.log(a > 5);   // true\nconsole.log(a <= 10); // true\nconsole.log(a != b);  // false\nconsole.log(a !== b); // true"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "4. Logical Operators 🧠"
        },
        {
          "type": "paragraph",
          "text": "These guys are like connecting puzzle pieces to make decisions—super helpful for conditions!"
        },
        {
          "type": "list",
          "items": [
            "<b>&& (AND): </b>Both conditions must be true.<br>Example: (5 > 3) && (6 > 2) is true because both are true.",

            "<b>|| (OR): </b> The first is true if at least one of the conditions is met.<br>Example: (5 < 3) || (6 > 2) is true because the second condition is true.",

            "<b>! (NOT): </b>Flips the truth—makes true become false, and false become true.<br>Example: !(5 > 3) is false because 5 > 3 is true, and ! flips it to false."
          ]
        },
        {
          "type": "textarea",
          "text": "let isSunny = true;\nlet hasUmbrella = false;\nconsole.log(isSunny && hasUmbrella); // false (both need to be true)\nconsole.log(isSunny || hasUmbrella); // true (one is enough)\nconsole.log(!isSunny); // false (opposite of true)"
        },
        {
          "type": "paragraph",
          "text": "🎉 Congrats on making it through Chapter One! You’re off to a great start! 🎉🥳 You’ve officially crossed the first checkpoint on your JavaScript journey! 🛤️"
        }
      ]
    }
  ],
  "Functions and Objects": [
    {
      "title": "JS Functions",
      "description": "🎉 Chapter Two: Functions and Objects in JavaScript 🎉",
      "sub_description": "Welcome back, JavaScript Explorer! 🌟On to the next exciting adventure into the coding world.",
      "additional_info": "In this chapter, we’re going to dive deep into two of the most powerful features of JavaScript: <b>Functions and Objects! 🚀</b>",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What is a Function?"
        },
        {
          "type": "paragraph",
          "text": "This function is like a magic box🪄 which will do things for you. It takes some input, does a bit of work, and gives you back a result.  Think of it as a recipe: you gather your ingredients (inputs), follow the steps (the code inside the function), and you get a delicious dish (the output)! 🍽️"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Why Do We Use Functions? 🤔"
        },
        {
          "type": "list",
          "items": [
            "<b>Reusability: </b>Write the function once, and you can call it multiple times. It’s like having a special button that gives you your favorite snack whenever you press it! 🍪",
            "<b>Organization: </b>Functions help you keep your code neat and tidy. By grouping related code together, you make it easier to read and maintain. 🗂️",
            "<b>Abstraction: </b>You can hide complex logic inside functions, making your main code cleaner and easier to understand. It is like one knows how to use a washing machine without having to know what is going on inside!🧺"
          ]
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Function Definitions and Declarations 📚"
        },
        {
          "type": "paragraph",
          "text": "<b>Function Declaration</b>"
        },
        {
          "type": "paragraph",
          "text": " This is the most common way to declare a function.You declare it using the keyword for functions, the name of the function, parentheses, and curly braces."
        },
        {
          "type": "paragraph",
          "text": "<b>Example:</b>"
        },
        {
          "type": "textarea",
          "text": "function greet(name) {\n\treturn `Hello, ${name}!`;\n}",
          "template": "function greet(name) {\n\treturn `Hello, ${name}!`;\n}\nconsole.log(greet('Webcooks!')); // Outputs: Hello, Webcooks!"
        },
        {
          "type": "paragraph",
          "text": "Explanation:"
        },
        {
          "type": "list",
          "items": [
            "<b>Function Keyword:</b> Begins with function.",
            "<b>Name: </b>greet is the name of the function.",
            "<b>Parameters: </b>name is a placeholder for the input you’ll provide.",
            "<b>Body: </b>The code inside {} that defines what the function does."
          ]
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Function Expression"
        },
        {
          "type": "paragraph",
          "text": "You can also create functions as expressions. This is the declaration of an anonymous function assigned to a variable. "
        },
        {
          "type": "textarea",
          "text": "const greet = function(name) {\n\treturn `Hello, ${name}!`;\n};",
          "template": "const greet = function(name) {\n\treturn `Hello, ${name}!`;\n};\nconsole.log(greet('Webcooks!')); // Outputs: Hello, Webcooks!"
        },
        {
          "type": "paragraph",
          "text": "Here, greet is the variable that holds the anonymous function. You can call it just like a declared function."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Arrow Functions (introduced in ES6)"
        },
        {
          "type": "paragraph",
          "text": "They decrease the declaration of a function's syntax.  They're great for short functions and help keep your code clean!"
        },
        {
          "type": "textarea",
          "text": "const greet = (name) => `Hello, ${name}!`;",
          "template": "const greet = (name) => `Hello, ${name}!`;\nconsole.log(greet('Webcooks!')); // Outputs: Hello, Webcooks!"
        },
        {
          "type": "paragraph",
          "text": "With an arrow function, you can omit the function keyword and declare using more compact syntax. If your function is a single line, you are not obligated to use curlies or the return keyword. "
        },
        {
          "type": "heading",
          "level": 2,
          "text": "🔄 Function Calling"
        },
        {
          "type": "paragraph",
          "text": "Once you have defined a function, you can call it anytime you need it. Calling a function is like telling the magic box to do its job! To call a function you just call its name using parentheses. If the function requires parameters, you provide the values inside the parentheses."
        },
        {
          "type": "textarea",
          "text": "console.log(greet('Webcooks!')); // Outputs: Hello, Webcooks!",
          "template": "function greet(name) {\n\treturn `Hello, ${name}!`;\n}\nconsole.log(greet('Webcooks!')); // Outputs: Hello, Webcooks!"
        },
        {
          "type": "paragraph",
          "text": "<b>Working:</b>"
        },
        {
          "type": "list",
          "items": [
            "<b>Function Name: </b>greet is the function that we declared earlier.",
            "<b>Argument: </b>'Webcooks' is the argument passed to the function. This value replaces the parameter name inside the function.",
            "<b>Output: </b>The function runs and returns the string Hello, Webcooks!, which gets printed to the console."
          ]
        },
        {
          "type": "paragraph",
          "text": "And there you have it! You now know what functions are, how to define and declare them, and how to call them in your code.🚀"
        }
      ]
    },
    {
      "title": "Function Parameters and Return Values",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️",
      "sub_description": "Today, we’re diving deeper into the magical world of functions, focusing on Function Parameters and Return Values.",
      "additional_info": "These will enable you to drive the most possible power out of functions and make your code even more dynamic! 🌈",
      "content": [
        {
          "type": "heading",
         "level": 2,
          "text": "What are Function Parameters? 🤔"
        },
        {
          "type": "paragraph",
          "text": "Think of function parameters as the ingredients you add to your magic box (the function) to help it create something special. They are the values you pass into a function so that it can use them to perform its task. Just like how you can’t bake a cake without flour, eggs, or sugar, a function can’t do its work without parameters!"
        },
        {
          "type": "textarea",
          "text": "function add(a, b) {\n\treturn a + b;\n}\nlet result = add(5,7);\nconsole.log(`The sum is: ${result}`);"
        },
        {
          "type": "paragraph",
          "text": "In this case, a and b are the ingredients of the recipe—the parameters. When we call add(5, 7), we’re saying, <i>“Hey, add these two numbers for me!”</i> The function grabs those values, does its math magic, and returns 12. Easy peasy, right?"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Return Values: The Grand Finale! 🎆"
        },
        {
          "type": "paragraph",
          "text": "So now that our function has done its job, how does it give us the result? That’s where the return value comes in. When we return something from a function, it’s like the function’s way of saying, “Here’s what you asked for!” Once it is returned back, the function completes the task and gives us the outcome."
        },
        {
          "type": "paragraph",
          "text": "<b>Let’s look at another example:</b>"
        },
        {
          "type": "textarea",
          "text": "function multiply(x, y) {\nreturn x * y;\n}\nlet product = multiply(3, 4);\nconsole.log(`The product is: ${product}`);"
        },
        {
          "type": "paragraph",
          "text": "Here, multiply(3, 4) returns 12, which we store in product. Now we can use product elsewhere in our code to make decisions, display it to users, or, hey, maybe do even more math with it. 🔢"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Parameters + Return Values"
        },
        {
          "type": "paragraph",
          "text": "When you combine parameters and return values, you get functions that are versatile and useful!<br> <b>Here’s a quick example to summarize:</b>"
        },
        {
          "type": "textarea",
          "text": "function calculateArea(length, width) {\nreturn length * width;\n}\nlet area = calculateArea(5, 10);\nconsole.log(`The area is: ${area}`);"
        },
        {
          "type": "paragraph",
          "text": "In above example: <b>length</b> and <b>width</b> are the values we pass into the function (Parameters) and the function calculates the area and returns the result."
        },
        {
          "type": "paragraph",
          "text": "And that, my JavaScript Wizards, is how we create functions that truly work wonders. 🌠"
        }
      ]
    },
    {
      "title": "Closures and Scope",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️",
      "sub_description": "Today, we’re going to explore the fascinating concepts of closures and scope. These concepts are essential for understanding how JavaScript handles variables and functions, allowing you to write cleaner and more efficient code.",
      "additional_info": "Let’s dive in! 🌊",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "Understanding Scope 🧭"
        },
        {
          "type": "paragraph",
          "text": "Let’s kick things off with scope. Imagine you’re in a library with different sections (like fiction, non-fiction, etc.). Each section has its own set of books (variables) that you can only access when you’re in that section.<br> There are two types of scope in JavaScript: global and local."
        },
        {
          "type": "paragraph",
          "text": "1. <b>Global Scope:</b>  If you declare a variable outside of any function, it's available everywhere in your code. Think of it like the main section of the library where everyone can access any book."
        },
        {
          "type": "textarea",
          "text": "let globalVariable = \"I am global!\";\n\nfunction displayGlobal() {\n\tconsole.log(globalVariable);\n}\n\ndisplayGlobal();"
        },
        {
          "type": "paragraph",
          "text": "2 <b>Local Scope:</b> Variables declared within a function are only accessible inside that function. It’s like a private reading room where only a few select members can access the books."
        },
        {
          "type": "textarea",
          "text": "function localScope() {\n\tlet localVariable = \"I am local!\";\n\tconsole.log(localVariable);\n}\nlocalScope();\n\n// console.log(localVariable); // Error: localVariable is not defined"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "What Are Closures? 🔍"
        },
        {
          "type": "paragraph",
          "text": "Now, let’s talk about closures. A closure is a function that remembers its lexical scope, the scope in which it was created, even when it's executed outside that scope.It’s like having a library card that lets you access books from your favorite section, no matter where you are in the library!"
        },
        {
          "type": "paragraph",
          "text": "Here's a very simple example:"
        },
        {
          "type": "textarea",
          "text": "function outerFunction() {\n\tlet outerVariable = \"I am from the outer function!\";\n\tfunction innerFunction() {\n\t\tconsole.log(outerVariable); // Accessing outerVariable\n\t}\n\treturn innerFunction; // Returning innerFunction\n}\n\nlet closureFunction = outerFunction(); // Creating a closure\nclosureFunction(); // Output: I am from the outer function"
        },
        {
          "type": "paragraph",
          "text": "In this example:<br>"
        },
        {
          "type": "list",
          "items": [
            "<b>outerFunction</b> creates a variable <b>outerVariable</b> and defines an <b>innerFunction</b>.",
            "When we invoke  <b>outerFunction</b>, it returns <b>innerFunction</b>, which is saved into <b>closureFunction</b>.",
            "Even after <b>outerFunction</b> has returned, <b>innerFunction</b> can still look at values for  <b>outerVariable</b> because  innerFunction still remembers its surroundings. Magic, right? 🪄"
          ]
        },
        {
          "type": "paragraph",
          "text": "And that’s a wrap on closures and scope, my JavaScript Wizards! 🧙‍♀️And that's it-you're one step closer to mastering the art of JavaScript!🌟"
        }
      ]
    },
    {
      "title": "Object Creation and Properties",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️",
      "sub_description": "Today we're going to talk about this magic thing called objects in JavaScript! Objects are like magical treasure chests that hold related data and functions, making your code cleaner and more organized.",
      "additional_info": "Let’s unlock the secrets of object creation! 🔑",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What is an Object? 📦"
        },
        {
          "type": "paragraph",
          "text": "An object, actually in JavaScript, is an accumulation of key-value pairs. Think of it as a magical wardrobe where each item (property) is labeled (key) so you can easily find what you need! 🌈"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Creating an Object 🛠️"
        },
        {
          "type": "paragraph",
          "text": "Creating objects is done in many ways, but we'll get started with the most basic: the object literal!Just like making a sandwich, all you need is some bread (curly braces) and your favorite fillings (key-value pairs)!"
        },
        {
          "type": "textarea",
          "text": "let sandwich = {\n\tbread: \"whole grain\",\n\tfilling: \"peanut butter\",\n\tcondiment: \"jelly\"\n};\n\nconsole.log(sandwich); // Output: { bread: 'whole grain', filling: 'peanut butter', condiment: 'jelly' }"
        },
        {
          "type": "paragraph",
          "text": "In this example, we created a delicious sandwich object with properties like <b>bread</b>, <b>filling</b>, and <b>condiment</b>. Who's hungry? 🍞"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Accessing Object Properties 🔍"
        },
        {
          "type": "paragraph",
          "text": "Now that we have our sandwich, let’s see how to grab those tasty properties! You can access them using dot notation or bracket notation. It’s like choosing whether to use a fork or your hands—both work, but one might be messier! 😄"
        },
        {
          "type": "textarea",
          "text": "console.log(sandwich.bread); // Output: whole grain\nconsole.log(sandwich['filling']); // Output: peanut butter",
          "template": "let sandwich = {\n\tbread: \"whole grain\",\n\tfilling: \"peanut butter\",\n\tcondiment: \"jelly\"\n};\nconsole.log(sandwich.bread); // Output: whole grain\nconsole.log(sandwich['filling']); // Output: peanut butter\nconsole.log(sandwich);"
        },
        {
          "type": "paragraph",
          "text": "See how easy that is? Just remember, when using bracket notation, the key must be a string.Otherwise, you will get a confusing sandwich!🥪"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Adding and Modifying Properties ✏️"
        },
        {
          "type": "paragraph",
          "text": "Just like you can add extra toppings to your sandwich, you can also add or modify properties of an object. Let’s spice things up with some bananas! 🍌"
        },
        {
          "type": "textarea",
          "text": "sandwich['extra'] = \"bananas\";\nconsole.log(sandwich); // Output: { bread: 'whole grain', filling: 'peanut butter', condiment: 'jelly', extra: 'bananas' }",
          "template": "let sandwich = {\n\tbread: \"whole grain\",\n\tfilling: \"peanut butter\",\n\tcondiment: \"jelly\"\n};\nsandwich['extra'] = \"bananas\";\nconsole.log(sandwich); // Output: { bread: 'whole grain', filling: 'peanut butter', condiment: 'jelly', extra: 'bananas' }\nconsole.log(sandwich);"
        },
        {
          "type": "paragraph",
          "text": "You can also change the existing properties, like swapping out jelly for honey. Sweet! 🍯"
        },
        {
          "type": "textarea",
          "text": "sandwich.condiment = \"honey\";\nconsole.log(sandwich); // Output: { bread: 'whole grain', filling: 'peanut butter', condiment: 'honey', extra: 'bananas' }",
          "template": "let sandwich = {\n\tbread: \"whole grain\",\n\tfilling: \"peanut butter\",\n\tcondiment: \"jelly\"\n};\nsandwich.condiment = \"honey\";\nconsole.log(sandwich); // Output: { bread: 'whole grain', filling: 'peanut butter', condiment: 'honey', extra: 'bananas' }\nconsole.log(sandwich);"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Wrapping Up 🎁"
        },
        {
          "type": "paragraph",
          "text": "And you're good to go! Now you know how to build and work with objects in JavaScript. With these skills, you’ll be making deliciously organized code in no time! 🥳"
        },
        {
          "type": "paragraph",
          "text": "Happy coding, my fellow JavaScript Wizards! Until next time! ✨"
        }
      ]
    },
    {
      "title": "Object Methods",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️",
      "sub_description": "Today, we’re going to learn about object methods! These are functions that belong to objects, and they help us do things with those objects.",
      "additional_info": "Now, let's get started.🌊",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What Are Object Methods? 🛠️"
        },
        {
          "type": "paragraph",
          "text": "Object methods are like the actions an object can perform. Think of an object like a robot. Just like a robot can walk or talk, an object can do things through methods."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Creating Methods 🎨"
        },
        {
          "type": "paragraph",
          "text": "Let’s create a simple object for a dog and give it a method to bark. Here’s how we can do it:"
        },
        {
          "type": "textarea",
          "text": "let dog = {\n\tname: \"Buddy\",\n\tbreed: \"Golden Retriever\",\n\tbark: function() {\n\t\tconsole.log(\"Woof! Woof!\");\n\t}\n};"
        },
        {
          "type": "paragraph",
          "text": "In this example, the <b>bark</b> method makes the dog bark when we call it. It’s like giving our dog a command to show off its barking skills! 🐶"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Calling Methods 📞"
        },
        {
          "type": "paragraph",
          "text": "Now that we have our dog and its barking method, let’s see how we can make the dog bark:"
        },
        {
          "type": "textarea",
          "text": "dog.bark(); // Output: Woof! Woof!",
          "template": "let dog = {\n\tname: \"Buddy\",\n\tbreed: \"Golden Retriever\",\n\tbark: function() {\n\t\tconsole.log(\"Woof! Woof!\");\n\t}\n};\ndog.bark(); // Output: Woof! Woof!\nconsole.log(dog);"
        },
        {
          "type": "paragraph",
          "text": "When we call <b>dog.bark()</b>, it makes our dog bark! Easy, right? 😄"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Using <b>this</b> Keyword 🔮"
        },
        {
          "type": "paragraph",
          "text": "The <b>this</b> keyword helps methods know which object they belong to. Let’s create another object, a car, to see how <b>this</b> works:"
        },
        {
          "type": "textarea",
          "text": "let car = {\n\tbrand: \"Toyota\",\n\tmodel: \"Corolla\",\n\tgetDetails: function() {\n\t\treturn `${this.brand} ${this.model}`;\n\t}\n};"
        },
        {
          "type": "paragraph",
          "text": "Here, the <b>getDetails</b> method uses <b>this</b> to access the car's brand and model. Let’s see it in action:"
        },
        {
          "type": "textarea",
          "text": "console.log(car.getDetails()); // Output: Toyota Corolla",
          "template": "let car = {\n\tbrand: \"Toyota\",\n\tmodel: \"Corolla\",\n\tgetDetails: function() {\n\t\treturn `${this.brand} ${this.model}`;\n\t}\n};\nconsole.log(car.getDetails()); // Output: Toyota Corolla\nconsole.log(car);"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Conclusion 🎉"
        },
        {
          "type": "paragraph",
          "text": "And there you have it! You learned what an object method is and how to create and use it. Now you can make your objects do cool things!"
        },
        {
          "type": "paragraph",
          "text": "Have fun coding, and keep practicing! You go with flying colors!🌟"
        }
      ]
    },
    {
      "title": "Object Constructors",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️",
      "sub_description": "Today, we're diving into object constructors! These special functions enable us to construct multiple objects of almost the same type, such as attributes and methods.",
      "additional_info": "Let’s get started! 🚀",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What Are Object Constructors? 🏗️"
        },
        {
          "type": "paragraph",
          "text": "An object constructor is a function used to create objects. It acts like a blueprint. Just like a blueprint helps you build several houses, an object constructor helps you create multiple objects with the same structure."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Creating an Object Constructor 🔧"
        },
        {
          "type": "paragraph",
          "text": "Let’s create a constructor for a simple <b>Car</b> object. Here’s how it looks:"
        },
        {
          "type": "textarea",
          "text": "function Car(brand, model) {\n\tthis.brand = brand;\n\tthis.model = model;\n\tthis.start = function() {\n\t\tconsole.log(`Starting the ${this.brand} ${this.model}...`);\n\t};\n}"
        },
        {
          "type": "paragraph",
          "text": "In this example, the <b>Car</b> constructor takes <b>brand</b> and <b>model</b> as parameters. Inside, we set the properties and add a <b>start</b> method."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Creating Objects with the Constructor 🏎️"
        },
        {
          "type": "paragraph",
          "text": "Now that we have our constructor, let's create some car objects using it:"
        },
        {
          "type": "textarea",
          "text": "let myCar = new Car(\"Toyota\", \"Corolla\");\nlet yourCar = new Car(\"Honda\", \"Civic\");",
          "template": "function Car(brand, model) {\n\tthis.brand = brand;\n\tthis.model = model;\n\tthis.start = function() {\n\t\tconsole.log(`Starting the ${this.brand} ${this.model}...`);\n\t};\n}\nlet myCar = new Car(\"Toyota\", \"Corolla\");\nlet yourCar = new Car(\"Honda\", \"Civic\");\nconsole.log(myCar);\nconsole.log(yourCar);"
        },
        {
          "type": "paragraph",
          "text": "Here, <b>myCar</b> is a Toyota Corolla, and <b>yourCar</b> is a Honda Civic. We create new objects from the constructor, using the new keyword."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Using the Methods 🚗"
        },
        {
          "type": "paragraph",
          "text": "Let's start our cars using the <b>start</b> method:"
        },
        {
          "type": "textarea",
          "text": "myCar.start(); // Output: Starting the Toyota Corolla...\nyourCar.start(); // Output: Starting the Honda Civic...",
          "template": "function Car(brand, model) {\n\tthis.brand = brand;\n\tthis.model = model;\n\tthis.start = function() {\n\treturn(`Starting the ${this.brand} ${this.model}...`);\n\t};\n}\nlet myCar = new Car(\"Toyota\", \"Corolla\");\nconsole.log(myCar.start());"
        },
        {
          "type": "paragraph",
          "text": "When we call <b>myCar.start()</b>, it tells us that the Toyota Corolla is starting! How cool is that? 😄"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Conclusion 🎉"
        },
        {
          "type": "paragraph",
          "text": "And that’s a wrap on object constructors! You’ve learned how to create objects using constructors, allowing you to build multiple objects easily."
        },
        {
          "type": "paragraph",
          "text": "Now keep practicing and you will all be masters of JavaScript in no time! Happy coding!🌟"
        }
      ]
    },  
    {
      "title": "Prototypes and Inheritance",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️",
      "sub_description": "Today, we’re diving into the exciting world of prototypes and inheritance in JavaScript. These two topics are going to make you appreciate the fact that in Object-Oriented languages such as JavaScript, objects do actually share properties and methods. These practices will really help you optimize your code quite a lot and organize your self much better.🚀",
      "additional_info": "So Let's get started! Are you all ready to take the knowledge of JavaScript to an All New High? Alright Then!!! 🎉",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "Understanding Prototypes 🐾"
        },
        {
          "type": "paragraph",
          "text": "Everything in JavaScript has a prototype. A prototype would be more of a template containing properties and methods of all objects created based on this prototype.If an object does not have some particular property or method, JavaScript will go look for it in the prototype of that object."
        },
        {
          "type": "heading",
          "level": 3,
          "text": "Example: Animal and Dog"
        },
        {
          "type": "textarea",
          "text": "function Animal(name) {\n    this.name = name;\n}\n\nAnimal.prototype.speak = function() {\n    console.log(this.name + ' makes a noise.');\n};\n\nfunction Dog(name) {\n    Animal.call(this, name); // Call the parent constructor\n}\n\nDog.prototype = Object.create(Animal.prototype); // Inherit methods\n\nDog.prototype.speak = function() {\n    console.log(this.name + ' barks.');\n};\n\nlet dog = new Dog('Rex');\ndog.speak(); // Output: Rex barks."
        },
        {
          "type": "paragraph",
          "text": "In this example, we first create an `Animal` constructor. We then add a `speak` method to its prototype. The `Dog` constructor inherits from `Animal`, so it can use the `speak` method. However, we also override the `speak` method in `Dog` to make it say that the dog barks. When we create a `Dog` object named `Rex` and call `speak`, it outputs: 'Rex barks.' 🎉"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Understanding Inheritance 🌳"
        },
        {
          "type": "paragraph",
          "text": "Inheritance is the property of one object to get properties and methods from another object. This helps to create a hierarchy of objects by making code reusable and manageable."
        },
        {
          "type": "heading",
          "level": 3,
          "text": "Example: Vehicle and Car"
        },
        {
          "type": "textarea",
          "text": "function Vehicle(make, model) {\n    this.make = make;\n    this.model = model;\n}\n\nVehicle.prototype.start = function() {\n    console.log('Starting ' + this.make + ' ' + this.model + '.');\n};\n\nfunction Car(make, model, doors) {\n    Vehicle.call(this, make, model); // Call the parent constructor\n    this.doors = doors;\n}\n\nCar.prototype = Object.create(Vehicle.prototype); // Inherit methods\n\nCar.prototype.start = function() {\n    console.log('Starting the car: ' + this.make + ' ' + this.model + ' with ' + this.doors + ' doors.');\n};\n\nlet car = new Car('Toyota', 'Corolla', 4);\ncar.start(); // Output: Starting the car: Toyota Corolla with 4 doors."
        },
        {
          "type": "paragraph",
          "text": " In this example, we have a `Vehicle` constructor with a `start` method. The `Car` constructor inherits from `Vehicle`, gaining access to the `start` method. We also add a new property `doors` for the `Car`. So when we try to create a `Car` object and call `start`, it outputs: 'Starting the car: Toyota Corolla with 4 doors.' 🚗💨"
        },
        {
          "type": "paragraph",
          "text": "And that's a wrap on prototypes and inheritance! Now you can create more structured and efficient JavaScript code. Happy coding! 🎉"
        }
      ]
    }
      
  ],
  "Arrays and Strings": [
    {
      "title": "Array Creation",
      "description": "Welcome to the third chapter of our JavaScript adventure! 🚀",
      "sub_description": "In this chapter, we will learn how to make arrays in JavaScript.  Arrays are like magic boxes that can hold a collection of items, making it super easy to organize and manage data.",
      "additional_info": "Welcome to the world of arrays!🌊",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What is an Array? 📦"
        },
        {
          "type": "paragraph",
          "text": "An array is one of the special variables that can store more than a single value at the same time. Think of it like shopping cart where you can fit all the items you will buy. Instead of holding each item separately, just carry one cart 🛒"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "How to Create an Array 🛠️"
        },
        {
          "type": "paragraph",
          "text": "In JavaScript, you can create arrays in a couple of ways. Let’s check them out!"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "1. Using Array Literal Notation 🌱"
        },
        {
          "type": "paragraph",
          "text": "This is the most common method used to create an array. You simply use square brackets [ ] and put your items inside, separated by commas."
        },
        {
          "type": "textarea",
          "text": "let fruits = ['Apple', 'Banana', 'Orange'];\nconsole.log(fruits); // Output: ['Apple', 'Banana', 'Orange']"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "2. Using the Array Constructor 📏"
        },
        {
          "type": "paragraph",
          "text": "An array may be created using the array constructor. Just use the keyword new followed by Array()."
        },
        {
          "type": "textarea",
          "text": "let vegetables = new Array('Carrot', 'Potato', 'Tomato');\nconsole.log(vegetables); // Output: ['Carrot', 'Potato', 'Tomato']"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Accessing Array Elements 🔍"
        },
        {
          "type": "paragraph",
          "text": "Access to the elements of an array using the index.You notice that array indices are defined starting from 0. So the first element goes to index 0, then follows the second at index 1, and so forth."
        },
        {
          "type": "textarea",
          "text": "console.log(fruits[0]); // Output: 'Apple'\nconsole.log(vegetables[1]); // Output: 'Potato'",
          "template": "let fruits = ['Apple', 'Banana', 'Orange'];\nconsole.log(fruits[0]);"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Modifying Arrays ✏️"
        },
        {
          "type": "paragraph",
          "text": "You can easily change the items in an array. Just use the index to point to the item you want to change."
        },
        {
          "type": "textarea",
          "text": "fruits[1] = 'Grapes';\nconsole.log(fruits); // Output: ['Apple', 'Grapes', 'Orange']",
          "template": "let fruits = ['Apple', 'Banana', 'Orange'];\nfruits[1] = 'Grapes';\nconsole.log(fruits);"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Array Length 📏"
        },
        {
          "type": "paragraph",
          "text": "You can ask the size of an array using the length property."
        },
        {
          "type": "textarea",
          "text": "console.log(fruits.length); // Output: 3\nconsole.log(vegetables.length); // Output: 3",
          "template": "let fruits = ['Apple', 'Banana', 'Orange'];\nconsole.log(fruits.length);"
        },
        {
          "type": "paragraph",
          "text": "And that’s a wrap for this module! Now you know how to create arrays, access their elements, modify them, and find their length! 🎉Now, practice and you will soon be an array master."
        }
      ]
    },
    {
      "title": "Array Methods",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️ This module is part of our third chapter.",
      "sub_description": "Today, we’re diving into some essential array methods that will make you a master at handling arrays!",
      "additional_info": "Let's start and unlock the magic of arrays! 🌈",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "1. Push and Pop 🍕"
        },
        {
          "type": "paragraph",
          "text": "The push method adds one or more items at the end of an array, whereas pop removes the last item.It's like adding a slice of pizza and then munching it down! Who doesn't love pizza?"
        },
        {
          "type": "textarea",
          "text": "let fruits = [\"apple\", \"banana\"];\n\n// Add a fruit\nfruits.push(\"orange\"); // Now fruits is [\"apple\", \"banana\", \"orange\"]\n\n// Remove the last fruit\nlet lastFruit = fruits.pop(); // lastFruit is \"orange\"\nconsole.log(fruits); // Output: [\"apple\", \"banana\"]"
        },
        {
          "type": "paragraph",
          "text": "<b>Parameters:</b>The unshift method accepts one or more items that you want to add to the starting of the array. For <b>pop</b>, there are no parameters since it simply removes the last item."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "2. Shift and Unshift 🍔"
        },
        {
          "type": "paragraph",
          "text": "<b>Shift</b> removes the first item from an array, while <b>unshift</b> adds one or more items to the beginning. Think of it like adding or taking away ingredients from a sandwich!"
        },
        {
          "type": "textarea",
          "text": "let sandwich = [\"lettuce\", \"tomato\"];\n\n// Add a new ingredient at the front\n sandwich.unshift(\"bread\"); // Now sandwich is [\"bread\", \"lettuce\", \"tomato\"]\n\n// Remove the first ingredient\nlet firstIngredient = sandwich.shift(); // firstIngredient is \"bread\"\nconsole.log(sandwich); // Output: [\"lettuce\", \"tomato\"]"
        },
        {
          "type": "paragraph",
          "text": "<b>Parameters:</b> The <b>unshift</b> method accepts one or more items that you want to add to the beginning of the array. The <b>shift</b> method doesn’t take any parameters, as it simply removes the first item."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "3. Slice and Splice ✂️"
        },
        {
          "type": "paragraph",
          "text": "<b>Slice</b> will create a new array to be by slicing out a portion of an existing array while <b>splice</b> is modifying the existing array by adding or deleting elements from it.It's like slicing a cake or splicing it with new flavors!"
        },
        {
          "type": "textarea",
          "text": "// Using slice\nlet colors = [\"red\", \"green\", \"blue\", \"yellow\"];\nlet selectedColors = colors.slice(1, 3); // Gets elements from index 1 to 2\nconsole.log(selectedColors); // Output: [\"green\", \"blue\"]\n\n// Using splice\ncolors.splice(1, 2, \"purple\", \"orange\"); // Removes 2 items from index 1 and adds purple and orange\nconsole.log(colors); // Output: [\"red\", \"purple\", \"orange\", \"yellow\"]"
        },
        {
          "type": "paragraph",
          "text": "<b>Parameters:</b> The <b>slice</b> function takes two parameters: start index and end index, which is an exclusive index. The <b>splice</b> function also takes three parameters: the first one is the start index, the second one is the number of elements to delete, and finally, one or more elements to add to the array."
        },
        {
          "type": "paragraph",
          "text": "If we don't want to remove any element using <b>splice()</b> then we can use <b>0</b> in second parameter."
        },
        {
          "type": "paragraph",
          "text": "For this case, the ending index is exclusive. Splice() method takes three arguments- a starting index, a number of elements to remove, and one or more elements to insert into the array. In case we have no intention to delete any element using splice(), then we can pass 0 in the second parameter."
        }
      ]
    },
    {
      "title": "Iteration Methods",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️",
      "sub_description": "In this module, we’ll explore some powerful iteration methods that allow you to efficiently work with arrays.",
      "additional_info": "Let’s dive into the magic of iteration! 🌟",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "1. forEach 🔄"
        },
        {
          "type": "paragraph",
          "text": "The forEach method calls a supplied function once for each array element. It's like having the whole army of little elves marching their way through your array!"
        },
        {
          "type": "textarea",
          "text": "let numbers = [1, 2, 3, 4];\n\nnumbers.forEach(num => console.log(num * 2)); // Output: 2, 4, 6, 8"
        },
        {
          "type": "paragraph",
          "text": "In this example, we use <b>forEach</b> to multiply each number in the <b>numbers</b> array by 2 and log the result to the console. Each number is processed individually, and we get the output as a result!"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "2. map 🗺️"
        },
        {
          "type": "paragraph",
          "text": "The <b>map</b> method accepts a function argument and returns an array containing the result of applying that function on each element in the input array. It's like creating a treasure map of new values!"
        },
        {
          "type": "textarea",
          "text": "let numbers = [1, 2, 3, 4];\n\nlet doubled = numbers.map(num => num * 2); // Creates a new array [2, 4, 6, 8]\nconsole.log(doubled);"
        },
        {
          "type": "paragraph",
          "text": "In this example, <b>map</b> takes each number in the <b>numbers</b> array, doubles it, and creates a new array called <b>doubled</b> with the results. The original array remains unchanged!"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "3. filter 🧹"
        },
        {
          "type": "paragraph",
          "text": "The function <b>filter</b> generates a new array filled with elements for which a provided function returns true. It’s like filtering out the fruits from a basket!"
        },
        {
          "type": "textarea",
          "text": "let numbers = [1, 2, 3, 4];\n\nlet evenNumbers = numbers.filter(num => num % 2 === 0); // Creates a new array [2, 4]\nconsole.log(evenNumbers);"
        },
        {
          "type": "paragraph",
          "text": "Here we use filter to pull from the numbers all even numbers. The function for each of the numbers checks if it's even, hence could be divided without the remainder by 2, and therefore adds it to the new array evenNumbers."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "4. reduce ➕"
        },
        {
          "type": "paragraph",
          "text": "The <b>reduce</b> method applies a reducer function to every element in the array, producing a singularity value return. It’s like combining all your toys into one big toy box!"
        },
        {
          "type": "textarea",
          "text": "let numbers = [1, 2, 3, 4];\n\nlet sum = numbers.reduce((accumulator, num) => accumulator + num, 0); // Output: 10\nconsole.log(sum);"
        },
        {
          "type": "paragraph",
          "text": "Here the <b>reduce</b> function is used with all elements from the numbers array, and combines them into one value, here calculated as the sum of the numbers."
        },
        {
          "type": "paragraph",
          "text": "And that's it, my JavaScript Wizards!🧙‍♀️ With these iteration methods in your toolkit, you can easily process and manipulate arrays like a pro. Keep practicing, and you’ll be a JavaScript master in no time! 🌟"
        }
      ]
    },
    {
      "title": "String Methods",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️ In this module, part of our third chapter, we’ll explore the magical world of strings. Strings are arrays of characters, like words or sentences, which you can manipulate in many ways.",
      "sub_description": "Let’s unlock the power of string methods! 🔑",
      "additional_info": "Get ready to make your text sparkle! ✨",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What is a String? 📖"
        },
        {
          "type": "paragraph",
          "text": "A string is a data type in JavaScript to represent a sequence of characters. This sequence can be letters, numbers, symbols, and spaces. But basically, you can imagine it as a line of text that you can manipulate and analyze!"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "1. length 📏"
        },
        {
          "type": "paragraph",
          "text": "The <b>length</b> property gives you how many characters are in a string. It's as though you're counting how many letters there are in your name."
        },
        {
          "type": "textarea",
          "text": "let greeting = \"Hello, world!\";\nconsole.log(greeting.length); // Output: 13"
        },
        {
          "type": "paragraph",
          "text": "In this example, the <b>length</b> property tells us that the string <b>greeting</b> has 13 characters, including letters, punctuation, and spaces."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "2. toUpperCase 🔤"
        },
        {
          "type": "paragraph",
          "text": "The <b>toUpperCase</b> method changes all characters in a string to uppercase letters. It's like shouting your message from the rooftops."
        },
        {
          "type": "textarea",
          "text": "let message = \"hello\";\nconsole.log(message.toUpperCase()); // Output: HELLO"
        },
        {
          "type": "paragraph",
          "text": "In this example, <b>toUpperCase</b> transforms the string <b>message</b> from \"hello\" to \"HELLO\".Just when you want to make a statement."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "3. toLowerCase 🔡"
        },
        {
          "type": "paragraph",
          "text": "The <b>toLowerCase</b> method changes all characters in a string to lowercase letters.It’s like whispering softly!"
        },
        {
          "type": "textarea",
          "text": "let shout = \"HELLO\";\nconsole.log(shout.toLowerCase()); // Output: hello"
        },
        {
          "type": "paragraph",
          "text": "In this example, <b>toLowerCase</b> changes the string <b>shout</b> from \"HELLO\" to \"hello\". A great way to tone it down!"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "4. slice 🔪"
        },
        {
          "type": "paragraph",
          "text": "<b>Slice</b> method cuts off a section of string and returns it as an additional string. It is like cutting out a slice from the cake to enjoy."
        },
        {
          "type": "textarea",
          "text": "let fruit = \"Banana\";\nconsole.log(fruit.slice(1, 4)); // Output: ana"
        },
        {
          "type": "paragraph",
          "text": "In this example, <b>slice</b> takes the string <b>fruit</b> and extracts characters starting from index 1 to index 4, returning \"ana\". Make sure the ending index is get excluded like Here, the ending index is 4 and we get slice from 1 to 3 index."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "5. replace 🔄"
        },
        {
          "type": "paragraph",
          "text": "The <b>replace</b> method locates a given value in a string then replaces it with another value. It's like swapping ingredients in a recipe!"
        },
        {
          "type": "textarea",
          "text": "let sentence = \"I like apples.\";\nconsole.log(sentence.replace(\"apples\", \"bananas\")); // Output: I like bananas."
        },
        {
          "type": "paragraph",
          "text": "In this example, <b>replace</b> changes the word \"apples\" to \"bananas\" in the string <b>sentence</b>. Now you like bananas instead!"
        },
        {
          "type": "paragraph",
          "text": "And there you have it, my JavaScript Wizards! 🧙‍♀️ With these string methods in your toolbox, you can manipulate text like a pro. Keep practicing, and let your creativity flow! 🌊"
        }
      ]
    },
    {
      "title": "String Search Methods",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️ In this module, we’ll dive into string search methods that help you find information hidden within your strings. Just like a treasure hunt, we’ll uncover where specific characters or words are located!",
      "sub_description": "Let’s go on a search mission! 🕵️‍♂️",
      "additional_info": "Get ready to track down those elusive letters and words! 🔍",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "1. indexOf 🔍"
        },
        {
          "type": "paragraph",
          "text": "The <b>indexOf</b> method searches for a specified value in a string and returns the index (position) of the first occurrence. If it can't find the value, then it returns -1. Think of it as your personal detective searching for a specific word!"
        },
        {
          "type": "textarea",
          "text": "let sentence = \"I love programming!\";\nlet position = sentence.indexOf(\"love\");\nconsole.log(position); // Output: 2"
        },
        {
          "type": "paragraph",
          "text": "In this example, <b>indexOf</b> looks for the word \"love\" in the string <b>sentence</b> and finds it starting at index 2. If we were searching for \"Python,\" it would return -1 since it's not there!"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "2. includes ✔️"
        },
        {
          "type": "paragraph",
          "text": "The <b>includes</b> method returns True if a string contains a value and False otherwise. It’s like asking, \"Do I have any chocolate left?\""
        },
        {
          "type": "textarea",
          "text": "let phrase = \"JavaScript is awesome!\";\nlet hasAwesome = phrase.includes(\"awesome\");\nconsole.log(hasAwesome); // Output: true"
        },
        {
          "type": "paragraph",
          "text": "In this example, <b>includes</b> checks if the string <b>phrase</b> contains the word \"awesome\" and returns true because it’s there! If we checked for \"boring,\" it would return false."
        },
        {
          "type": "paragraph",
          "text": "And that’s a wrap on string search methods, my JavaScript Wizards! 🧙‍♀️With indexOf and includes, you can always find exactly what you're looking for in your strings. Keep searching and coding like the pros you are! 🚀"
        }
      ]
    },
    {
      "title": "String Templates (Template Literals)",
      "description": "Welcome back, JavaScript Wizards! 🧙‍♂️",
      "sub_description": "In this module, we’ll explore the wonderful world of string templates, also known as template literals. These nifty features make it easier to work with strings, especially when we want to embed variables or create multi-line text.",
      "additional_info": "Let’s get started! 🚀",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What Are Template Literals? 🌟"
        },
        {
          "type": "paragraph",
          "text": "Template literals are an approach to string creation in the JavaScript language more flexible and clear than other existing conventional methods of string creation. Unlike regular strings, template literals let you embed expressions, making it super easy to include variables and create multi-line strings."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Creating Template Literals 🛠️"
        },
        {
          "type": "paragraph",
          "text": "Instead of using single ' or double quotes (\"\"), a template literal is created using backticks ``.Here’s how it works:"
        },
        {
          "type": "textarea",
          "text": "const name = 'Webcooks';\nconst greeting = `Hello, ${name}! Welcome to JavaScript learning.`;\nconsole.log(greeting); // Output: Hello, Webcooks! Welcome to JavaScript learning."
        },
        {
          "type": "paragraph",
          "text": "In this example, we declared a variable called <b>name</b> and used it within our template literal. The expression inside the ${} gets evaluated, and the resulting value is included in the string. Magic, right? 🪄"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Multi-line Strings 📜"
        },
        {
          "type": "paragraph",
          "text": "Use template literals to write a multi-line strings using even less escape characters. Check it out:"
        },
        {
          "type": "textarea",
          "text": "const poem = `Roses are red,\nViolets are blue,\nJavaScript is great,\nAnd so are you!`;\nconsole.log(poem);"
        },
        {
          "type": "paragraph",
          "text": "In this example, we created a multi-line string for a little poem. Each line is automatically recognized without any fuss! 🌼"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Using Template Literals with Functions ⚙️"
        },
        {
          "type": "paragraph",
          "text": "You can also use template literals in combination with functions for dynamic content. Try it: "
        },
        {
          "type": "textarea",
          "text": "function greetUser(user) {\n    return `Hello, ${user}! How are you today?`;\n}\n\nconsole.log(greetUser('Webcooks')); // Output: Hello, Webcooks! How are you today?"
        },
        {
          "type": "paragraph",
          "text": "We define a function, greetUser, where we take the name of the user as an argument and return a template literal greeting.Quick and straightforward method to creating dynamic messages.😊"
        },
        {
          "type": "paragraph",
          "text": "Template literals are a fantastic way to simplify string creation and make your JavaScript code more readable. Happy coding, Wizards! ✨"
        }
      ]
    }
  ],
  "Dates, Math, Control Structures and Error Handling": [
    {
      "title": "Creating and Formatting Dates",
      "description": "Welcome to the 4th Chapter, JavaScript Wizards! 🎉",
      "sub_description": "In this chapter, you are going to see how to create dates and format them in JavaScript. After creating your dates, it is time to know how to manipulate them so that you get the right date-related tasks for your applications.",
      "additional_info": "Let’s dive into the world of dates! 📅",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "Creating Dates 📆"
        },
        {
          "type": "paragraph",
          "text": "In JavaScript, you can create a date using the <b>Date</b> object. This object can be created in several ways."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Using the Current Date and Time ⏰"
        },
        {
          "type": "paragraph",
          "text": "Getting a date object that will represent the current date and time is as simple as invoking the Date constructor without any arguments: "
        },
        {
          "type": "textarea",
          "text": "const currentDate = new Date();\nconsole.log(currentDate); // Outputs the current date and time"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Creating a Specific Date 🗓️"
        },
        {
          "type": "paragraph",
          "text": "You can also create a date for a specific time using the following syntax: <b>new Date(year, month, day, hours, minutes, seconds)</b>. Note that the month is zero-based (0 for January, 1 for February, etc.)."
        },
        {
          "type": "textarea",
          "text": "const specificDate = new Date(2024, 0, 1); // January 1, 2024\nconsole.log(specificDate);"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Formatting Dates 🖊️"
        },
        {
          "type": "paragraph",
          "text": "Now, once you've got your date, you might want to print it out in a more readable form.JavaScript provides several methods for formatting dates."
        },
        {
          "type": "heading",
          "level": 3,
          "text": "Using toLocaleDateString() 🌍"
        },
        {
          "type": "paragraph",
          "text": "The method returns a language-sensitive string representing the date. You can also specify options for formatting."
        },
        {
          "type": "textarea",
          "text": "const options = { year: 'numeric', month: 'long', day: 'numeric' };\nconst formattedDate = currentDate.toLocaleDateString('en-US', options);\nconsole.log(formattedDate); // Example: October 27, 2024",
          "template": "const currentDate = new Date();\nconst options = { year: 'numeric', month: 'long', day: 'numeric' };\nconst formattedDate = currentDate.toLocaleDateString('en-US', options);\nconsole.log(formattedDate);"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "Using toISOString() 🌐"
        },
        {
          "type": "paragraph",
          "text": "If you need a standardized format, use the <b>toISOString()</b> method, which returns the date in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ)."
        },
        {
          "type": "textarea",
          "text": "const isoString = currentDate.toISOString();\nconsole.log(isoString); // Example: 2024-10-27T10:00:00.000Z",
          "template": "const currentDate = new Date();\nconst isoString = currentDate.toISOString();\nconsole.log(isoString); "
        },
        {
          "type": "paragraph",
          "text": "And there you go! You learned how to create and format dates with JavaScript in this lesson.Keep on coding and may your dates always be correct!🥳"
        }
      ]
    },
    {
      "title": "Date Methods",
      "description": "Welcome to the 4th Chapter, JavaScript Wizards! 🎉",
      "sub_description": "In this module, we're going to see which methods are available within the Date object. Using these methods, you can easily manipulate and retrieve information from the date.",
      "additional_info": "Let’s get started with Date methods! 📅",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "Working with Date Methods 🛠️"
        },
        {
          "type": "paragraph",
          "text": "JavaScript provides several built-in methods for the Date object that help you work with dates effectively. Here are some commonly used methods:"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "1. getFullYear() 📅"
        },
        {
          "type": "paragraph",
          "text": "This method returns the year (4 digits) of a specified date."
        },
        {
          "type": "textarea",
          "text": "const date = new Date();\nconst year = date.getFullYear();\nconsole.log(year); // Example output: 2024"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "2. getMonth() 🗓️"
        },
        {
          "type": "paragraph",
          "text": "This method returns the month of a specified date as a number (0 for January, 1 for February, etc.)."
        },
        {
          "type": "textarea",
          "text": "const month = date.getMonth();\nconsole.log(month); // Example output: 9 (for October)",
          "template": "const date = new Date();\nconst month = date.getMonth();\nconsole.log(month);"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "3. getDate() 📆"
        },
        {
          "type": "paragraph",
          "text": "Returns the day of the month of a date between 1 and 31."
        },
        {
          "type": "textarea",
          "text": "const day = date.getDate();\nconsole.log(day); // Example output: 27",
          "template": "const date = new Date();\nconst day = date.getDate();\nconsole.log(day);"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "4. getHours() ⏰"
        },
        {
          "type": "paragraph",
          "text": "This method returns the hour (0-23) of a specified date."
        },
        {
          "type": "textarea",
          "text": "const hours = date.getHours();\nconsole.log(hours); // Example output: 10",
          "template": "const date = new Date();\nconst hours = date.getHours();\nconsole.log(hours);"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "5. getMinutes() 🕒"
        },
        {
          "type": "paragraph",
          "text": "This method returns the minutes (0-59) of a specified date."
        },
        {
          "type": "textarea",
          "text": "const minutes = date.getMinutes();\nconsole.log(minutes); // Example output: 30",
          "template": "const date = new Date();\nconst mintes = date.getMinutes();\nconsole.log(mintes);"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "6. getSeconds() ⏱️"
        },
        {
          "type": "paragraph",
          "text": "This method returns the seconds (0-59) of a specified date."
        },
        {
          "type": "textarea",
          "text": "const seconds = date.getSeconds();\nconsole.log(seconds); // Example output: 45",
          "template": "const date = new Date();\nconst seconds = date.getSeconds();\nconsole.log(seconds);"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "7. getTime() ⏳"
        },
        {
          "type": "paragraph",
          "text": "This method returns the numeric value corresponding to the time for the specified date, which is the number of milliseconds since January 1, 1970."
        },
        {
          "type": "textarea",
          "text": "const time = date.getTime();\nconsole.log(time); // Example output: 1698401000000",
          "template": "const date = new Date();\nconst time = date.getTime();\nconsole.log(time);"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "8. setFullYear(year) 🛠️"
        },
        {
          "type": "paragraph",
          "text": "This method sets the year of a specified date."
        },
        {
          "type": "textarea",
          "text": "date.setFullYear(2025);\nconsole.log(date.getFullYear()); // Example output: 2025",
          "template": "const date = new Date();\ndate.setFullYear(2025);\nconsole.log(date.getFullYear());"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "9. setMonth(month) 📅"
        },
        {
          "type": "paragraph",
          "text": "This method sets the month of a specified date."
        },
        {
          "type": "textarea",
          "text": "date.setMonth(11); // Setting month to December\nconsole.log(date.getMonth()); // Example output: 11",
          "template": "const date = new Date();\ndate.setMonth(11);\nconsole.log(date.getMonth());"
        },
        {
          "type": "paragraph",
          "text": "These are just a few of the many methods you can use with the Date object. Mastering all of these techniques allows you to play with dates as you wish. Good luck coding! 🥳"
        }
      ]
    },
    {
      "title": "Math Methods",
      "description": "Welcome to the 4th Chapter, JavaScript Wizards! 🎉",
      "sub_description": "In this module, we’re diving into JavaScript’s Math object, a built-in library of useful mathematical functions and constants. From rounding numbers to generating random ones, Math methods make these tasks easy!",
      "additional_info": "Let’s explore the power of Math! 🧮",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "Introduction to Math Methods 🔢"
        },
        {
          "type": "paragraph",
          "text": "The Math object of JavaScript provides several methods for mathematical operations. Here are some popular ones you’ll use often:"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "1. Math.round() 🔄"
        },
        {
          "type": "paragraph",
          "text": "Returns the input number rounded to the nearest integer. When the decimal is.5 or more, it will round it up; otherwise, it will round down."
        },
        {
          "type": "textarea",
          "text": "const rounded = Math.round(4.7);\nconsole.log(rounded); // Output: 5\n\nconst roundedDown = Math.round(4.3);\nconsole.log(roundedDown); // Output: 4"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "2. Math.floor() ⬇️"
        },
        {
          "type": "paragraph",
          "text": "Rounds a number down to the nearest integer, regardless of the decimal value."
        },
        {
          "type": "textarea",
          "text": "const floored = Math.floor(4.9);\nconsole.log(floored); // Output: 4"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "3. Math.ceil() ⬆️"
        },
        {
          "type": "paragraph",
          "text": "Rounds a number up to the nearest integer, no matter the decimal."
        },
        {
          "type": "textarea",
          "text": "const ceiling = Math.ceil(4.1);\nconsole.log(ceiling); // Output: 5"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "4. Math.max() 🏆"
        },
        {
          "type": "paragraph",
          "text": "Returns the largest number of a list of numbers. Perfect for finding the highest score!"
        },
        {
          "type": "textarea",
          "text": "const maxNum = Math.max(3, 7, 2, 10);\nconsole.log(maxNum); // Output: 10"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "5. Math.min() 🥇"
        },
        {
          "type": "paragraph",
          "text": "Returns the smallest number of a list of numbers. Great for locating the smallest values."
        },
        {
          "type": "textarea",
          "text": "const minNum = Math.min(3, 7, 2, 10);\nconsole.log(minNum); // Output: 2"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "6. Math.sqrt() ✔️"
        },
        {
          "type": "paragraph",
          "text": "Returns the square root of a number. Use this for calculating lengths and distances."
        },
        {
          "type": "textarea",
          "text": "const squareRoot = Math.sqrt(16);\nconsole.log(squareRoot); // Output: 4"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "7. Math.pow() 💪"
        },
        {
          "type": "paragraph",
          "text": "Raises a number to the power of another number. For example, `Math.pow(2, 3)` means 2 raised to the power of 3."
        },
        {
          "type": "textarea",
          "text": "const power = Math.pow(2, 3);\nconsole.log(power); // Output: 8"
        },
        {
          "type": "heading",
          "level": 3,
          "text": "8. Math.random() 🎲"
        },
        {
          "type": "paragraph",
          "text": "Generates a random decimal between 0 and 1. Handy for generating random numbers for games and simulations."
        },
        {
          "type": "textarea",
          "text": "const randomNum = Math.random();\nconsole.log(randomNum); // Output: A random decimal like 0.4573"
        },
        {
          "type": "paragraph",
          "text": "These Math methods are essential tools for performing calculations in JavaScript, making your code more powerful and dynamic. Keep experimenting and enjoy the magic of Math! 🪄"
        }
      ]
    }
  ],
  "JS Control Structures": [
    {
      "title": "Booleans and Comparisons",
      "description": "Welcome to Chapter 5: JS Control Structures! 🎉",
      "sub_description": "In this first module, we’re diving into Booleans and Comparisons, which are the backbone of decision-making in JavaScript. Understanding these concepts will help you create code that can make choices and respond to different situations.",
      "additional_info": "Let’s get started with some true or false fun! 🕹️",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What are Booleans? 🤔"
        },
        {
          "type": "paragraph",
          "text": "Booleans are variables in JavaScript, that may only hold two values, either true or false.Think about it as a light switch that's either ON (true) or OFF (false).Booleans are super useful for making decisions in code based on certain conditions."
        },
        {
          "type": "textarea",
          "text": "let isRaining = true;\nlet isSunny = false;\nconsole.log(isRaining); // Output: true\nconsole.log(isSunny); // Output: false"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Comparisons: Making Choices with Code 🌐"
        },
        {
          "type": "paragraph",
          "text": "Boolean Decisions With Code Comparison checks two values and returns a Boolean result - it can be true or false."
        },
        {
          "type": "heading",
          "level": 3,
          "text": "Comparison Operators 📏"
        },
        {
          "type": "paragraph",
          "text": "JavaScript has several comparison operators.This is the most commonly used; here's a short list:"
        },
        {
          "type": "list",
          "items": [
            "<code>==</code> : Checks if two values are equal. (It doesn’t care about the type!)",
            "<code>===</code> : Compares two values for equality AND for being of the same type.",
            "<code>!=</code> : Comparing two values for not equal.",
            "<code>!==</code> : Two values are not equal, or are of different type.",
            "<code>&gt;</code> : The left expression is large compared to the right.",
            "<code>&gt;=</code> : Left-hand side has greater than or equal to right-hand side.",
            "<code>&lt;</code> : A left value smaller than its right counterpart.",
            "<code>&lt;=</code> : The left-hand value is smaller or equal to the right."
          ]
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Examples of Comparison Operators in Action 🧪"
        },
        {
          "type": "paragraph",
          "text": "Let's look at how some of these comparison operators work with simple examples:"
        },
        {
          "type": "textarea",
          "text": "console.log(5 == '5');    // Output: true (because '5' is converted to 5)\nconsole.log(5 === '5');   // Output: false (different types: number and string)\nconsole.log(10 != 8);     // Output: true\nconsole.log(7 !== '7');   // Output: true (different types)\nconsole.log(5 > 3);       // Output: true\nconsole.log(5 <= 5);      // Output: true"
        },
        {
          "type": "paragraph",
          "text": "In the examples above:\n- <code>5 == '5'</code> is <code>true</code> because <code>==</code> converts '5' to a number.\n- <code>5 === '5'</code> is <code>false</code> since <code>===</code> checks both value and type.\n- <code>7 !== '7'</code> is <code>true</code> because they’re not the same type.\n\nUsing the right operator can prevent unexpected results. <code>===</code> and <code>!==</code> are generally safer to use when you want strict equality!"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Combining Comparisons with Logical Operators 🧩"
        },
        {
          "type": "paragraph",
          "text": "Sometimes, one comparison just isn’t enough! We can combine multiple comparisons using logical operators to make even smarter decisions."
        },
        {
          "type": "list",
          "items": [
            "<code>&&</code> : Logical AND (both conditions need to be <code>true</code> for the result to be <code>true</code>)",
            "<code>||</code> : Logical OR (if at least one condition is <code>true</code>, the result is <code>true</code>)",
            "<code>!</code> : Logical NOT (reverses the Boolean value; <code>!true</code> becomes <code>false</code>)"
          ]
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Example: Combining Conditions 🔗"
        },
        {
          "type": "paragraph",
          "text": "Let’s use logical operators to check if two conditions are both true. For instance, checking if someone is eligible for a club membership (they must be 18 or older AND have a membership card)."
        },
        {
          "type": "textarea",
          "text": "let age = 20;\nlet hasMembershipCard = true;\n\nif (age >= 18 && hasMembershipCard) {\n\tconsole.log(\"Welcome to the club!\"); // Output: Welcome to the club!\n} else {\n\tconsole.log(\"Sorry, you can't enter.\");\n}"
        },
        {
          "type": "paragraph",
          "text": "In this example:\n- Both conditions, <code>age >= 18</code> and <code>hasMembershipCard</code>, are <code>true</code>, so the message <code>\"Welcome to the club!\"</code> is displayed.\n- If either condition were <code>false</code>, the message <code>\"Sorry, you can't enter.\"</code> would appear."
        },
        {
          "type": "paragraph",
          "text": "With Booleans and comparisons, you now can write code that makes decisions. Keep practicing, and soon these operators will feel like second nature! 💡"
        }
      ]
    },
    {
      "title": "Conditional Statements",
      "description": "Welcome back to Chapter 5: JS Control Structures! 🚦",
      "sub_description": " In this module, we will learn how to make decisions in code by making use of conditional statements.These are essential for guiding your code's behavior based on different conditions, so let's jump in and learn how to make our code think! 🤓",
      "additional_info": "Ready to see some code make choices? Let’s go! 🕹️",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What are Conditional Statements? 🤔"
        },
        {
          "type": "paragraph",
          "text": "Conditional statements allow us to check conditions in our code and decide what happens next. They’re like asking questions, such as, 'If it’s raining, should I bring an umbrella?' In JavaScript, the main conditional statements are <code>if</code>, <code>else if</code>, <code>else</code>, and <code>switch</code>."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>if</code> Statement 🕵️‍♂️"
        },
        {
          "type": "paragraph",
          "text": "The <code>if</code> statement checks if a condition is <code>true</code>. If it is, the code inside the <code>if</code> block runs. If it’s not, JavaScript skips that code. Imagine you're hungry, and you only eat if there's food available!"
        },
        {
          "type": "textarea",
          "text": "let isHungry = true;\n\nif (isHungry) {\n    console.log(\"Time to eat!\"); // Output: Time to eat!\n}"
        },
        {
          "type": "paragraph",
          "text": "In this example:\n- Since <code>isHungry</code> is <code>true</code>, the message <code>\"Time to eat!\"</code> is printed.\n- If <code>isHungry</code> were <code>false</code>, nothing would be printed, as JavaScript would skip the <code>if</code> block."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>else</code> Statement 😜"
        },
        {
          "type": "paragraph",
          "text": "The else statement executes a block of code if the condition of the if statement is false. Think of it as your backup plan: 'If I’m not hungry, I’ll keep working!'"
        },
        {
          "type": "textarea",
          "text": "let isHungry = false;\n\nif (isHungry) {\n    console.log(\"Time to eat!\");\n} else {\n    console.log(\"Keep working!\"); // Output: Keep working!\n}"
        },
        {
          "type": "paragraph",
          "text": "In this example:\n- Since <code>isHungry</code> is <code>false</code>, JavaScript skips the <code>if</code> block and goes to the <code>else</code> block, printing <code>\"Keep working!\"</code>."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>else if</code> Statement 🔄"
        },
        {
          "type": "paragraph",
          "text": "The else if statement enables you to test multiple conditions in sequence.Think of it as your backup plan: 'If I am not hungry, then I will keep working!"
        },
        {
          "type": "textarea",
          "text": "let isHungry = false;\nlet isSleepy = true;\n\nif (isHungry) {\n    console.log(\"Time to eat!\");\n} else if (isSleepy) {\n    console.log(\"Time for a nap!\"); // Output: Time for a nap!\n} else {\n    console.log(\"Keep working!\");\n}"
        },
        {
          "type": "paragraph",
          "text": "In this example:\n- The first condition (<code>isHungry</code>) is <code>false</code>, so it moves to the next condition (<code>isSleepy</code>), which is <code>true</code>, and prints <code>\"Time for a nap!\"</code>.\n- If neither condition was true, it would go to the <code>else</code> block and print <code>\"Keep working!\"</code>."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>switch</code> Statement 🔄"
        },
        {
          "type": "paragraph",
          "text": "A switch statement is quite useful when there are more than one possible values for one variable. It’s like deciding what to do based on the day of the week: 'If it’s Monday, do this; if it’s Tuesday, do that; and so on.'"
        },
        {
          "type": "textarea",
          "text": "let day = \"Monday\";\n\nswitch (day) {\n    case \"Monday\":\n        console.log(\"Start of the work week!\"); // Output: Start of the work week!\n        break;\n    case \"Friday\":\n        console.log(\"Almost weekend!\");\n        break;\n    case \"Saturday\":\n    case \"Sunday\":\n        console.log(\"Weekend!\");\n        break;\n    default:\n        console.log(\"Midweek grind!\");\n}"
        },
        {
          "type": "paragraph",
          "text": "In this example:\n- The variable <code>day</code> is set to <code>\"Monday\"</code>, so the switch statement finds the <code>case</code> that matches and runs the code <code>\"Start of the work week!\"</code>.\n-The break statement avoids the code from moving into the next case.\n- The <code>default</code> case runs if no matching case is found."
        },
        {
          "type": "paragraph",
          "text": "And there you have it! With conditional statements, you’re able to make your JavaScript code respond to different situations. Practice using these to create flexible and smart code that makes decisions! 🎉"
        }
      ]
    },
    {
      "title": "Loops",
      "description": "Welcome back to Chapter 5: JS Control Structures! 🔄",
      "sub_description": "In this module, we’ll explore loops, the amazing structures that let us run code repeatedly without having to type it multiple times. Ready to get looping? 🌀",
      "additional_info": "Loops help us do more with less code – let’s dive in! 🚀",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "What are Loops? 🎢"
        },
        {
          "type": "paragraph",
          "text": "Loops It is a loop of code that the computer will repeat continuously so long as some condition is still true. Imagine telling someone to hand you each item from a pile, one by one – that’s what loops do for our code!"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>for</code> Loop 🔂"
        },
        {
          "type": "paragraph",
          "text": "A <code>for</code> loop is like a timer: you set how many times it should run, and it counts down until it’s done. Let's see it in action!"
        },
        {
          "type": "textarea",
          "text": "for (let i = 0; i < 5; i++) {\n    console.log(\"Looping number: \" + i); // Output: Looping number: 0, 1, 2, 3, 4\n}"
        },
        {
          "type": "paragraph",
          "text": "Explanation: - let i = 0 assigns an initial value of 0 to the counter variable i. i < 5 Condition requires that the loop run as long as i is less than 5.i++ is a statement used after each iteration of the loop.\n- This loop prints <code>\"Looping number: 0\"</code> up to <code>\"Looping number: 4\"</code>."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>while</code> Loop 🔁"
        },
        {
          "type": "paragraph",
          "text": "A while loop continues running when the condition is true. It’s like asking, 'Is the jar empty? If not, take out another cookie.' 🍪"
        },
        {
          "type": "textarea",
          "text": "let counter = 0;\n\nwhile (counter < 3) {\n    console.log(\"Counter is at: \" + counter);\n    counter++;\n}\n// Output: Counter is at: 0, 1, 2"
        },
        {
          "type": "paragraph",
          "text": "Explanation:\n- The loop starts with <code>counter = 0</code>.\n- It checks if <code>counter < 3</code> – if true, it prints and then adds 1 to <code>counter</code>.\n- The loop stops when <code>counter</code> reaches 3, so it prints <code>\"Counter is at: 0\"</code> up to <code>\"Counter is at: 2\"</code>."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>do...while</code> Loop 🔄"
        },
        {
          "type": "paragraph",
          "text": "The do.while loop is like while but ensures a minimum run will occur, even though the condition is false. It’s like saying, 'Try this once, then keep going if needed.'"
        },
        {
          "type": "textarea",
          "text": "let counter = 0;\n\ndo {\n    console.log(\"Do this at least once!\");\n    counter++;\n} while (counter < 1);\n// Output: Do this at least once!"
        },
        {
          "type": "paragraph",
          "text": "Explanation:\n- This loop first executes <code>console.log</code> with the message.\n- Afterward, it checks if <code>counter < 1</code> – since it’s true initially, the loop runs once.\n- Even if the condition were <code>false</code> at the start, the message would still print once."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>for...of</code> Loop 📜"
        },
        {
          "type": "paragraph",
          "text": "<code>for...of</code> is perfect for looping over arrays (lists) and gives you each item directly. Imagine passing around a snack tray – each snack is handed to you one by one. 🍎"
        },
        {
          "type": "textarea",
          "text": "let fruits = [\"apple\", \"banana\", \"cherry\"];\n\nfor (let fruit of fruits) {\n    console.log(fruit); // Output: apple, banana, cherry\n}"
        },
        {
          "type": "paragraph",
          "text": "Explanation:\n- <code>fruits</code> is an array containing strings.\n- Each loop, <code>fruit</code> holds the current item from <code>fruits</code>, printing <code>apple</code>, <code>banana</code>, then <code>cherry</code>."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>for...in</code> Loop 🔍"
        },
        {
          "type": "paragraph",
          "text": "<code>for...in</code> lets you loop over object properties. It’s like getting keys to different rooms in a house and seeing what’s inside each one! 🏠"
        },
        {
          "type": "textarea",
          "text": "let person = { name: \"Alice\", age: 25, city: \"Wonderland\" };\n\nfor (let key in person) {\n    console.log(key + \": \" + person[key]);\n}\n// Output:\n// name: Alice\n// age: 25\n// city: Wonderland"
        },
        {
          "type": "paragraph",
          "text": "Explanation:\n- <code>person</code> is an object with properties.\n- <code>key</code> holds each property name (like <code>name</code> and <code>age</code>), allowing us to access each value by <code>person[key]</code>."
        },
        {
          "type": "paragraph",
          "text": "And that’s a wrap on loops! 🎉 Now you have the power to repeat tasks and make your code more efficient. Keep practicing to become a looping master!"
        }
      ]
    }
  ],
  "JS Error Handling": [
    {
      "title": "try, catch, finally",
      "description": "Welcome to Chapter 6: JS Error Handling! 🛠️",
      "sub_description": "In this module, we’ll learn how to catch errors in JavaScript, handle them gracefully, and ensure our code doesn’t break unexpectedly.Using try, catch, and finally, we can handle errors like pros!💪",
      "additional_info": "Let’s dive into error handling and make our code more reliable! 🚀",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "Why Use Error Handling? ⚠️"
        },
        {
          "type": "paragraph",
          "text": "Errors can pop up when we least expect them, whether it’s due to unexpected data or user input. Error handling allows us to catch these errors and take action instead of letting our code crash. Think of it like catching a ball thrown your way – you can control what happens next instead of getting hit! 🎾"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>try</code> Block"
        },
        {
          "type": "paragraph",
          "text": "The code you want to execute goes inside the try block.If everything goes well, it’ll complete without issues. But if an error occurs, it’ll be caught by the <code>catch</code> block. Let’s see how this works:"
        },
        {
          "type": "textarea",
          "text": "try {\n    // Code that might throw an error\n    let result = riskyOperation(); // assume riskyOperation might throw an error\n    console.log(\"Operation successful:\", result);\n} catch (error) {\n    console.log(\"Something went wrong:\", error.message);\n}"
        },
        {
          "type": "paragraph",
          "text": "Here:- The try block encompasses riskyOperation(), which throws an error.\n- If <code>riskyOperation()</code> runs without issues, the result is logged.\n-  In case of an error, it transfers control to the catch block, which then deals with it by printing an error message."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>catch</code> Block"
        },
        {
          "type": "paragraph",
          "text": "The catch Block It will execute only in case of an error in the execution of the try block.Here’s where you decide how to handle the error, such as displaying a message, logging it, or taking corrective action."
        },
        {
          "type": "textarea",
          "text": "try {\n    let data = riskyOperation();\n    console.log(data);\n} catch (error) {\n    console.log(\"Oops! Error occurred:\", error.message); // Example error message\n}"
        },
        {
          "type": "paragraph",
          "text": "Explanation: - In case riskyOperation() throws some exception the catch block gets run. And this is try, catch, and finally! \n- <code>error.message</code> gives us a human-readable message about what went wrong.\n- In this case, we print the message, but you could do anything here, like showing an alert or trying a different operation!"
        },
        {
          "type": "heading",
          "level": 2,
          "text": "The <code>finally</code> Block 🏁"
        },
        {
          "type": "paragraph",
          "text": "<code>finally</code> is a special block that always runs after <code>try</code> and <code>catch</code>, whether or not an error occurred. It is suitable for cleanup operations, such as closing files or stopping the loading animations."
        },
        {
          "type": "textarea",
          "text": "try {\n    let data = riskyOperation();\n    console.log(\"Data received:\", data);\n} catch (error) {\n    console.log(\"Something went wrong:\", error.message);\n} finally {\n    console.log(\"Operation complete.\"); // Always runs, success or failure\n}"
        },
        {
          "type": "paragraph",
          "text": "Explanation:\n- If <code>riskyOperation()</code> succeeds, <code>finally</code> still runs after logging the data.\n- If an error occurs, <code>catch</code> handles it, and then <code>finally</code> runs.\n- <code>finally</code> is useful for cleanup tasks, like stopping a loading spinner or resetting variables."
        },
        {
          "type": "paragraph",
          "text": "That's all on try, catch, and finally! With these tools, you can gracefully handle errors and keep your app running smoothly even when things go wrong. Great work, JS Error Handler! 🧑‍💻"
        }
      ]
    },
    {
      "title": "Throwing Custom Errors",
      "description": "Welcome back to Chapter 6: JS Error Handling! 🛠️",
      "sub_description": "We'll learn how to create our own error messages by using throw in this module.Custom errors allow us to catch specific issues and give clear messages on what went wrong in our code!",
      "additional_info": "Let’s jump into throwing custom errors! 🚀",
      "content": [
        {
          "type": "heading",
          "level": 2,
          "text": "Why Throw Custom Errors? 🤔"
        },
        {
          "type": "paragraph",
          "text": "Sometimes, JavaScript’s built-in errors don’t provide enough context, or you might want to handle specific conditions. By throwing custom errors, you can define your own error messages and make debugging easier."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Using <code>throw</code> to Create Custom Errors"
        },
        {
          "type": "paragraph",
          "text": "We use the <code>throw</code> keyword to create our own errors. The instance that the interpreter of JavaScript encounters throw, then it stops execution and waits for a catch block, which actually handles the error.  Here’s a basic example:"
        },
        {
          "type": "textarea",
          "text": "function checkAge(age) {\n    if (age < 18) {\n        throw new Error(\"Sorry, you must be 18 or older.\");\n    }\n    return \"Welcome!\";\n}\n\ntry {\n    console.log(checkAge(15)); // This will throw an error\n} catch (error) {\n    console.log(\"Error:\", error.message); // Output: Error: Sorry, you must be 18 or older.\n}"
        },
        {
          "type": "paragraph",
          "text": "Explanation: - Checks if age is less than 18 in checkAge - Thrown with a custom error message that the user must be above 18 years old. - In the try block, we call checkAge with 15, triggering an error.The catch block catches the error and then prints our custom message."
        },
        {
          "type": "heading",
          "level": 2,
          "text": "Throwing Different Types of Errors"
        },
        {
          "type": "paragraph",
          "text": "You’re not limited to <code>Error</code>! JavaScript provides various error types that are useful for specific cases, like <code>TypeError</code>, <code>RangeError</code>, and more. Let’s say you want to throw a <code>RangeError</code> if a number isn’t in a certain range:"
        },
        {
          "type": "textarea",
          "text": "function validateScore(score) {\n    if (score < 0 || score > 100) {\n        throw new RangeError(\"Score must be between 0 and 100.\");\n    }\n    return \"Score is valid!\";\n}\n\ntry {\n    console.log(validateScore(150)); // This will throw a RangeError\n} catch (error) {\n    console.log(\"Error Type:\", error.name); // Output: Error Type: RangeError\n    console.log(\"Error Message:\", error.message); // Output: Error Message: Score must be between 0 and 100.\n}"
        },
        {
          "type": "paragraph",
          "text": "Explanation:\n- The <code>validateScore</code> function checks if <code>score</code> is between 0 and 100.\n- If the <code>score</code> is out of range, it throws a <code>RangeError</code> with a custom message.\n- The <code>catch</code> block logs the error type (<code>RangeError</code>) and the custom message, making it clear what went wrong."
        },
        {
          "type": "paragraph",
          "text": "That’s how custom errors work! With <code>throw</code>, you have complete control over error handling and can make your messages helpful and specific. Keep these tools handy for cleaner debugging and a smoother coding experience! 🧑‍💻"
        }
      ]
    }    
  ]
}
