16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/day-37/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | The only task you have now is to start contributing to an Open Source Project, called `Web APIs Playground`.
6 |
7 | Please check out the video session to understand how to get started. Looking forward to see your contributions soon.
8 |
9 | > [Web APIs Playground](https://github.com/atapas/webapis-playground)
10 |
--------------------------------------------------------------------------------
/day-35/3-this/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Unhappy Button Click
7 |
8 |
9 |
10 |
11 |
18 |
19 |
--------------------------------------------------------------------------------
/day-07/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
3 |
4 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
5 |
6 | ## 1. Change the RPS Project
7 | Change the if-else to switch-case as asked in the video(at 15:42).
8 |
9 | ## 2. Build the Secret Number Guessing Game
10 | Create the project as explained in the video.
--------------------------------------------------------------------------------
/day-08/call-stack.js:
--------------------------------------------------------------------------------
1 | console.log("Inside Global Execution Context");
2 | var a = 5;
3 | function testMe() {
4 | console.log("Inside testMe Execution context");
5 | var b = 10;
6 | var user = {
7 | name: "tapas",
8 | country: "India"
9 | }
10 | function testAgain() {
11 | console.log("Inside testAgain Execution Context");
12 | console.log("Exiting testAgain Execution Context");
13 | }
14 | testAgain();
15 | console.log("Exiting testMe execution context");
16 | }
17 | testMe();
18 | console.log("Exiting global execution context");
--------------------------------------------------------------------------------
/day-23/pizzahub/lib/query.js:
--------------------------------------------------------------------------------
1 | function query(endpoint, options) {
2 | return new Promise((resolve, reject) => {
3 | setTimeout(() => {
4 | fetch(`http://localhost:3000/${endpoint}`, options)
5 | .then((response) => {
6 | if (!response.ok) {
7 | throw new Error(`HTTP error ${response.status}`);
8 | }
9 | return response.json();
10 | })
11 | .then(resolve)
12 | .catch(reject);
13 | }, 2000);
14 | });
15 | }
16 |
--------------------------------------------------------------------------------
/day-24/pizzahub/lib/query.js:
--------------------------------------------------------------------------------
1 | function query(endpoint, options) {
2 | return new Promise((resolve, reject) => {
3 | setTimeout(() => {
4 | fetch(`http://localhost:3000/${endpoint}`, options)
5 | .then((response) => {
6 | if (!response.ok) {
7 | throw new Error(`HTTP error ${response.status}`);
8 | }
9 | return response.json();
10 | })
11 | .then(resolve)
12 | .catch(reject);
13 | }, 2000);
14 | });
15 | }
16 |
--------------------------------------------------------------------------------
/day-09/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
3 |
4 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
5 |
6 | ## 1. Expian Temporal Dead Zone by creating 3 variables in side a block. Post the code as your answer.
7 |
8 | ## 2. Explain Variable and Function Hoisting with Example. Post the code as your answer.
9 |
10 |
--------------------------------------------------------------------------------
/day-30/oop/abstraction.js:
--------------------------------------------------------------------------------
1 | // Abstraction
2 |
3 | // Definition: Hiding internal details and showing only essential features.
4 | // In Code: Provide public methods like startEngine() while hiding what happens inside.
5 |
6 | class Car {
7 | startEngine() {
8 | this.#injectFuel();
9 | this.#ignite();
10 | console.log("Engine started");
11 | }
12 |
13 | #injectFuel() {
14 | console.log("Fuel injected");
15 | }
16 |
17 | #ignite() {
18 | console.log("Spark generated");
19 | }
20 | }
21 |
22 | // Only startEngine() is visible to users; internal complexity is abstracted.
--------------------------------------------------------------------------------
/day-21/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Quiz App
7 |
8 |
9 |
10 |
11 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/day-08/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
3 |
4 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
5 |
6 | ## 1. Draw the Execution Context Diagram of the follwoing code and share as explained below:
7 |
8 | ```js
9 | const message = "I can do it";
10 |
11 | fucntion sum(a, b) {
12 | const result = a + b;
13 | return result;
14 | }
15 |
16 | function mul(a, b) {
17 | const result = a * b;
18 | return result;
19 | }
20 | function calc(a, b) {
21 | return (sum(a, b) + mul(a,b))/2;
22 | }
23 |
24 | function getResult(a, b) {
25 | return calc(a, b);
26 | }
27 |
28 | getResult(8, 5);
29 | ```
30 |
31 | - Create the GEC and FEC with CP and EP flow
32 | - Create the Stack and Heap Flow
33 | - Create the Stack Diagram
34 | - Create a Readme file with all the above diagram and share on Discord.
35 |
36 |
--------------------------------------------------------------------------------
/day-18/projects/todo/logic.js:
--------------------------------------------------------------------------------
1 | console.log("Project: TODO");
2 |
3 | function addTask() {
4 | const taskInput = document.getElementById("taskInput");
5 | const taskList = document.getElementById("taskList");
6 |
7 | const task = taskInput.value;
8 |
9 | if (task.trim() === "") return;
10 |
11 | const li = document.createElement("li");
12 |
13 | li.innerText = task;
14 |
15 | const completeBtn = document.createElement("button");
16 | completeBtn.innerText = "✅";
17 | completeBtn.style.marginLeft = "5px";
18 | completeBtn.onclick = function () {
19 | li.classList.toggle("completed");
20 | };
21 | li.appendChild(completeBtn);
22 |
23 | const deleteBtn = document.createElement("button");
24 | deleteBtn.innerText = "❌";
25 | deleteBtn.style.marginLeft = "5px";
26 | deleteBtn.onclick = function () {
27 | li.remove();
28 | };
29 | li.appendChild(deleteBtn);
30 |
31 | taskList.appendChild(li);
32 |
33 | taskInput.value = "";
34 | }
35 |
36 | function filterTasks() {
37 | // Implement the filter functionality
38 | }
39 |
--------------------------------------------------------------------------------
/day-19/projects/faq.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | FAQ
9 |
10 |
11 |
12 |
13 |
14 |
15 |
What is JavaScript?
16 |
JavaScript is a scripting language used to create dynamic content.
17 |
18 |
19 |
What is the DOM?
20 |
The DOM is the Document Object Model representing the page structure.
21 |
22 |
23 |
What is 40 Days of JavaScript?
24 |
It is an initiative by tapaScript Family to win over JavaScript with fundamentals and code.
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/day-40/splitter/src/ui/domHelpers.js:
--------------------------------------------------------------------------------
1 | export class DOMHelpers {
2 | static getElementById(id) {
3 | const element = document.getElementById(id);
4 | if (!element) {
5 | throw new Error(`Element with id '${id}' not found`);
6 | }
7 | return element;
8 | }
9 |
10 | static createListItem(text, className = '') {
11 | const li = document.createElement('li');
12 | li.textContent = text;
13 | if (className) {
14 | li.className = className;
15 | }
16 | return li;
17 | }
18 |
19 | static createOption(text, value) {
20 | return new Option(text, value);
21 | }
22 |
23 | static clearElement(element) {
24 | while (element.firstChild) {
25 | element.removeChild(element.firstChild);
26 | }
27 | }
28 |
29 | static appendFragment(parent, items, createItemFn) {
30 | const fragment = document.createDocumentFragment();
31 | items.forEach(item => {
32 | fragment.appendChild(createItemFn(item));
33 | });
34 | parent.appendChild(fragment);
35 | }
36 | }
--------------------------------------------------------------------------------
/day-38/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | ## 1. Identify Reachable vs Unreachable Objects
6 |
7 | Write a small program where:
8 |
9 | - You create an object user
10 | - Create a second object profile that references user
11 | - Then set user = null
12 |
13 | Is the original user object still reachable? Why or why not?
14 |
15 | ## 2. Simulate and Break a Cyclic Reference
16 |
17 | Observe how cyclic references can cause memory retention.
18 |
19 | - Create two objects a and b
20 | - Make them reference each other (a.ref = b and b.ref = a)
21 | - Nullify external references to both
22 |
23 | Explain why this may or may not cause a memory leak. Add a.ref = null; b.ref = null; and explain how it helps
24 |
25 | ## 3. DOM Leak Detection and Fix
26 |
27 | Learn how DOM elements and closures can create memory leaks.
28 |
29 | - Create a button using JavaScript
30 | - Add an event listener that references a variable outside the listener
31 | - Remove the button from the DOM, but not the event listener
32 |
33 | Identify the leak & fix it.
34 |
--------------------------------------------------------------------------------
/day-35/1-discount/solution.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | function calculateDiscount(total) {
4 | let discount = 0;
5 | if (total >= 500) {
6 | discount = 0.2;
7 | } else if (total >= 300) {
8 | discount = 0.15;
9 | } else if (total >= 100) {
10 | discount = 0.1;
11 | }
12 |
13 | return total - total * discount;
14 | }
15 |
16 | // Test Cases
17 | console.log(calculateDiscount(50)); // Expected: 50 (no discount)
18 | console.log(calculateDiscount(150)); // Expected: 135
19 | console.log(calculateDiscount(350)); // Expected: 297.5
20 | console.log(calculateDiscount(600)); // Expected: 480
21 |
22 |
23 | /*
24 |
25 | What Was the Issue?
26 |
27 | - In the original code, the conditions might have been written in ascending order. This logic fails for higher totals like 500, because the first condition total >= 100 matches and short-circuits the rest — so 20% Discount is never reached.
28 |
29 | TIPS:
30 |
31 | - When using if...else if...else, always write conditions from the most specific/highest value to the least.
32 | - Debugging tip: Use console.log() to inspect which condition block your input hits.
33 |
34 | */
--------------------------------------------------------------------------------
/day-35/5-order/track-order.js:
--------------------------------------------------------------------------------
1 | async function getOrder(orderId) {
2 | return new Promise((resolve, reject) => {
3 | setTimeout(() => {
4 | if (orderId === "123") {
5 | resolve({ id: "123", item: "Book", status: "Processing" });
6 | } else {
7 | reject("Order not found!");
8 | }
9 | }, 1000);
10 | });
11 | }
12 |
13 | async function getTrackingInfo(order) {
14 |
15 | return new Promise((resolve, reject) => {
16 | setTimeout(() => {
17 | if (!order?.id) {
18 | reject("No Order ID");
19 | } else {
20 | resolve({ orderId: order.id, location: "Warehouse", eta: "2 days" });
21 | }
22 |
23 | }, 1000);
24 | });
25 | }
26 |
27 | async function trackOrder(orderId) {
28 | try {
29 | const order = getOrder(orderId);
30 | const tracking = await getTrackingInfo(order);
31 | console.log(`Tracking Order: ${tracking.orderId}`);
32 | console.log(`Current Location: ${tracking.location}`);
33 | console.log(`Estimated Delivery: ${tracking.eta}`);
34 | } catch (err) {
35 | console.error("Error:", err);
36 | }
37 | }
38 |
39 | trackOrder("123");
--------------------------------------------------------------------------------
/day-35/5-order/solution.js:
--------------------------------------------------------------------------------
1 | async function getOrder(orderId) {
2 | return new Promise((resolve, reject) => {
3 | setTimeout(() => {
4 | if (orderId === "123") {
5 | resolve({ id: "123", item: "Book", status: "Processing" });
6 | } else {
7 | reject("Order not found!");
8 | }
9 | }, 1000);
10 | });
11 | }
12 |
13 | async function getTrackingInfo(order) {
14 |
15 | return new Promise((resolve, reject) => {
16 | setTimeout(() => {
17 | if (!order?.id) {
18 | reject("No Order ID");
19 | } else {
20 | resolve({ orderId: order.id, location: "Warehouse", eta: "2 days" });
21 | }
22 |
23 | }, 1000);
24 | });
25 | }
26 |
27 | async function trackOrder(orderId) {
28 | try {
29 | const order = await getOrder(orderId);
30 | const tracking = await getTrackingInfo(order);
31 | console.log(`Tracking Order: ${tracking.orderId}`);
32 | console.log(`Current Location: ${tracking.location}`);
33 | console.log(`Estimated Delivery: ${tracking.eta}`);
34 | } catch (err) {
35 | console.error("Error:", err);
36 | }
37 | }
38 |
39 | trackOrder("123");
--------------------------------------------------------------------------------
/day-19/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Events
7 |
8 |
9 |
10 |
Welcome to the Day 19 - Events
11 |
Hope you are enjoying 40 days of JavaScript!
12 |
13 |
14 |
Event Handling
15 |
16 |
17 |
18 |
19 |
20 |
21 |
Event Object
22 |
23 |
24 |
25 | Event Bubbling, Capturing, and Delegation
26 |
27 |
28 | Event Default Behaviour
29 |
30 |
31 | Custom Event
32 |
33 |
34 | Project: FAQ
35 |
36 |
37 |
--------------------------------------------------------------------------------
/day-34/library/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 tapaScript
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/day-40/splitter/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 tapaScript
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/day-28/country-explorer/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 tapaScript
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/live/lets-code/inventory/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 tapaScript
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/day-07/README.md:
--------------------------------------------------------------------------------
1 | # Day 07 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Build the Project
6 | - ✅ Give an Assignment Project to Build
7 |
8 | ## 🫶 Support
9 | Your support means a lot.
10 |
11 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
12 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
13 |
14 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
15 |
16 | ### 🤝 Sponsor My Work
17 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
18 |
19 | ## Video
20 | Here is the video for you to go through and learn:
21 |
22 | [](https://youtu.be/fydbEttef04 "Video")
23 |
24 | ## **👩💻 🧑💻 Assignment Tasks**
25 |
26 | Please find the task assignments in the [Task File](./task.md).
27 |
--------------------------------------------------------------------------------
/day-27/README.md:
--------------------------------------------------------------------------------
1 | # Day 27 - 40 Days of JavaScript - Event Loop
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ The Chef’s Story
6 | - ✅ Functions and Call Stack
7 | - ✅ Async Code
8 | - ✅ Event Loop
9 | - ✅ Callback Queue
10 | - ✅ Job Queue
11 | - ✅ Tasks and What’s Next?
12 |
13 | ## 🫶 Support
14 |
15 | Your support means a lot.
16 |
17 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
18 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
19 |
20 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
21 |
22 | ### 🤝 Sponsor My Work
23 |
24 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
25 |
26 | ## Video
27 |
28 | Here is the video for you to go through and learn:
29 |
30 | [](https://youtu.be/4IYcwOfW3BM "Video")
31 |
--------------------------------------------------------------------------------
/day-26/README.md:
--------------------------------------------------------------------------------
1 | # Day 26 - 40 Days of JavaScript - Common Mistakes
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Introduction
6 | - ✅ Promises and Loop
7 | - ✅ Chain or No-Chain
8 | - ✅ Not Handling Errors
9 | - ✅ Missing Callback
10 | - ✅ Synchronous Operation
11 | - ✅ Unnecessary try/catch
12 | - ✅ Quick Recap
13 |
14 | ## 🫶 Support
15 |
16 | Your support means a lot.
17 |
18 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
19 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
20 |
21 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
22 |
23 | ### 🤝 Sponsor My Work
24 |
25 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
26 |
27 | ## Video
28 |
29 | Here is the video for you to go through and learn:
30 |
31 | [](https://youtu.be/c_zcXUz1neo "Video")
32 |
--------------------------------------------------------------------------------
/day-18/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
6 |
7 | ## 1. Create a form dynamically using JavaScript and manipulate its behavior
8 |
9 | - Add input fields dynamically based on user selection e.g., text, email, number
10 | - Add a submit button that logs all the input values as an object.
11 | - Add a reset button that clears the form.
12 | - Use createElement, appendChild, setAttribute, and addEventListener.
13 |
14 | ## 2. Add, delete, and search rows in a dynamic table
15 |
16 | - A form to add rows (Name, Age, Role).
17 | - Each row should have a “Delete” button to remove it.
18 | - Add a search input that filters the rows by name.
19 | - Use insertRow, deleteRow, and textContent/innerText.
20 |
21 | ## 3. Theme Switcher with Persistence
22 |
23 | - Toggle theme using a button or switch.
24 | - Persist the theme in localStorage and apply on page load.
25 | - Change background and text color based on the theme.
26 |
--------------------------------------------------------------------------------
/day-36/memoization/fibonacci/fib.js:
--------------------------------------------------------------------------------
1 | function fib(n) {
2 | if (n <= 2) return 1;
3 | return fib(n - 1) + fib(n - 2);
4 | }
5 |
6 | // 0, 1, 1, 2, 3, 5, 8, 13, 21, and so on.
7 |
8 |
9 | const memo = {};
10 | function fibMemo(n) {
11 | if (n in memo) return memo[n];
12 | if (n <= 2) return 1;
13 | memo[n] = fibMemo(n - 1) + fibMemo(n - 2);
14 | return memo[n];
15 | }
16 |
17 | function runNormal() {
18 | const n = parseInt(document.getElementById("num").value);
19 | const output = document.getElementById("output");
20 | const start = Date.now();
21 | console.log(start);
22 | const result = fib(n);
23 | const end = Date.now();
24 | console.log(end);
25 | output.innerHTML = `🔁 Normal Fib(${n}) = ${result} ⏱️ Time: ${(
26 | end - start
27 | )}ms`;
28 | }
29 |
30 | function runMemo() {
31 | const n = parseInt(document.getElementById("num").value);
32 | const output = document.getElementById("output");
33 | const start = Date.now();
34 | console.log(start);
35 | const result = fibMemo(n);
36 | const end = Date.now();
37 | console.log(end);
38 | output.innerHTML = `🧠 Memoized Fib(${n}) = ${result} ⏱️ Time: ${(
39 | end - start
40 | )}ms`;
41 | }
42 |
--------------------------------------------------------------------------------
/day-28/README.md:
--------------------------------------------------------------------------------
1 | # Day 28 - Building a Country Explorer App
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Before We Start
6 | - ✅ REST Country APIs
7 | - ✅ What Are We Building?
8 | - ✅ The Project Setup
9 | - ✅ The HTML Structure
10 | - ✅ Fetching Countries
11 | - ✅ Showing Details
12 | - ✅ The Map
13 | - ✅ The Time & TimeZone
14 | - ✅ What’s Next?
15 |
16 | ## 🫶 Support
17 |
18 | Your support means a lot.
19 |
20 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
21 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
22 |
23 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
24 |
25 | ### 🤝 Sponsor My Work
26 |
27 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
28 |
29 | ## Video
30 |
31 | Here is the video for you to go through and learn:
32 |
33 | [](https://www.youtube.com/watch?v=jXS0VURNqxA "Video")
34 |
--------------------------------------------------------------------------------
/day-20/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
6 |
7 | ## 1. Traverse and Toggle Classes
8 |
9 | Build a navigation menu. On click of a list item:
10 |
11 | - Traverse up to parent `
`
12 | - Remove .active class from all `
`
13 | - Add .active only to the clicked `
`
14 |
15 | ## 2. Highlight Text Using Range
16 |
17 | Use the Range API to highlight a portion of a paragraph by wrapping it with a `` tag.
18 |
19 | ## 3. Use DocumentFragment for Performance
20 |
21 | Insert 100 list items into the DOM using:
22 |
23 | - Plain DOM methods (one by one)
24 | - DocumentFragment (all at once)
25 |
26 | ## 4. Build a “Smart Cloner”
27 |
28 | Create a UI with an element and a “Clone” button. Use cloneNode(true) and cloneNode(false) and show the difference visually.
29 |
30 | ## 5. MutationObserver Watcher
31 |
32 | Create a div and use MutationObserver to log whenever:
33 |
34 | - A new child is added
35 | - The class attribute changes
36 | - Text is modified
37 |
--------------------------------------------------------------------------------
/day-04/README.md:
--------------------------------------------------------------------------------
1 | # Day 04 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - What is Control Flow and Branching
6 | - Understanding if-else all possible scenarios
7 | - Undersatanding switch-case all possible scenarios
8 | - Comparioson study between if-else and switch-case
9 | - Test and Assignments
10 |
11 | ## 🫶 Support
12 | Your support means a lot.
13 |
14 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
15 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
16 |
17 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
18 |
19 | ### 🤝 Sponsor My Work
20 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
21 |
22 | ## Video
23 | Here is the video for you to go through and learn:
24 |
25 | [](https://youtu.be/Fn_DhBu3VyU "Video")
26 |
27 | ## **👩💻 🧑💻 Assignment Tasks**
28 |
29 | Please find the task assignments in the [Task File](./task.md).
--------------------------------------------------------------------------------
/day-28/country-explorer/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Country Explorer
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
Country Explorer
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
Loading...
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/day-05/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
3 |
4 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
5 |
6 | ## 1. Generate a Pyramid Pattern using Nested Loop as it is shown below:
7 |
8 | ```bash
9 | *
10 | * *
11 | * * *
12 | * * * *
13 | * * * * *
14 | ```
15 |
16 | ## 2. Craete Multiplication Table (Using for loop)
17 | Write a program to print the multiplication table of a given number up to 10.
18 | For Example: If N = 3, output should be:
19 |
20 | ```bash
21 | 3 x 1 = 3
22 | 3 x 2 = 6
23 | ...
24 | 3 x 10 = 30
25 | ```
26 |
27 | ## 3. Find the summation of all odd numbers between 1 to 500 and print them on the console log.
28 |
29 | ## 4. Skipping Multiples of 3
30 | Write a program to print numbers from 1 to 20, but skip multiples of 3.
31 |
32 | ## 5. Reverse Digits of a Number (Using while loop)
33 | Write a program to reverse the digits of a given number using a while loop.
34 |
35 | Example:
36 |
37 | ```bash
38 | Input: 6789
39 | Output: 9876
40 | ```
41 |
42 | ## 6. Write your understanding on the difefrences between for, while, and do-while loop. Create their flow charts.
43 |
--------------------------------------------------------------------------------
/day-36/debounce/search.js:
--------------------------------------------------------------------------------
1 | const data = Array.from({ length: 10000 }, (_, i) => `Item ${i + 1}`);
2 |
3 | function debounce(fn, delay) {
4 | let timer;
5 | return function (...args) {
6 | clearTimeout(timer);
7 | timer = setTimeout(() => fn.apply(this, args), delay);
8 | };
9 | }
10 |
11 | function searchArray(query) {
12 | console.log("Search Executed", performance.now());
13 |
14 | const resultBox = document.getElementById("results");
15 |
16 | const filtered = data.filter((item) =>
17 | item.toLowerCase().includes(query.toLowerCase())
18 | );
19 |
20 | if (!query.trim()) {
21 | resultBox.innerHTML = "";
22 | return;
23 | }
24 |
25 | const limited = filtered.slice(0, 20); // Limit to first 20 matches
26 | resultBox.innerHTML = `
27 | Showing ${limited.length} of ${
28 | filtered.length
29 | } result(s)
30 |
${limited.map((item) => `
${item}
`).join("")}
31 | `;
32 | }
33 |
34 | // Ordinary Search
35 | const doSearch = (e) => {
36 | const query = e.target.value;
37 | searchArray(query);
38 | };
39 |
40 | const debouncedSearch = debounce((e) => {
41 | const query = e.target.value;
42 | searchArray(query);
43 | }, 500);
44 |
45 | document.getElementById("search").addEventListener("input", debouncedSearch);
46 |
--------------------------------------------------------------------------------
/day-09/README.md:
--------------------------------------------------------------------------------
1 | # Day 09 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Intro
6 | - ✅ Misconception About Hoisting
7 | - ✅ Variable Hoisting
8 | - ✅ Hoisting and let and const
9 | - ✅ Temporal Dead Zone(TDZ)
10 | - ✅ Functional Hoisting
11 | - ✅ Hoisting and Function As an Expression
12 | - ✅ Task and What’s Next?
13 |
14 | ## 🫶 Support
15 | Your support means a lot.
16 |
17 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
18 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
19 |
20 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
21 |
22 | ### 🤝 Sponsor My Work
23 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
24 |
25 | ## Video
26 | Here is the video for you to go through and learn:
27 |
28 | [](https://youtu.be/OqMxh1QdYEg "Video")
29 |
30 | ## **👩💻 🧑💻 Assignment Tasks**
31 |
32 | Please find the task assignments in the [Task File](./task.md).
33 |
--------------------------------------------------------------------------------
/day-18/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | DOM Manipulations
8 |
9 |
10 |
11 |
12 |
13 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/day-37/geolocation/geo.js:
--------------------------------------------------------------------------------
1 | const getLocationBtn = document.getElementById('getLocation');
2 | const output = document.getElementById('output');
3 |
4 | getLocationBtn.addEventListener('click', () => {
5 | if (!navigator.geolocation) {
6 | output.textContent = 'Geolocation is not supported by your browser.';
7 | return;
8 | }
9 |
10 | output.textContent = '📡 Locating...';
11 |
12 | navigator.geolocation.getCurrentPosition(
13 | (position) => {
14 | const { latitude, longitude } = position.coords;
15 | /*output.innerHTML = `
16 | Latitude: ${latitude.toFixed(5)}
17 | Longitude: ${longitude.toFixed(5)}
18 | `;*/
19 | output.innerHTML += ` Open in Google Maps`;
20 | },
21 | (error) => {
22 | switch (error.code) {
23 | case error.PERMISSION_DENIED:
24 | output.textContent = ' User denied the request.';
25 | break;
26 | case error.POSITION_UNAVAILABLE:
27 | output.textContent = ' Location information unavailable.';
28 | break;
29 | case error.TIMEOUT:
30 | output.textContent = ' The request timed out.';
31 | break;
32 | default:
33 | output.textContent = ' An unknown error occurred.';
34 | }
35 | }
36 | );
37 | });
--------------------------------------------------------------------------------
/day-38/README.md:
--------------------------------------------------------------------------------
1 | # Day 38 - JavaScript Memory Management and GC
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ What are We Learning?
6 | - ✅ Stack and Heap
7 | - ✅ Reachability
8 | - ✅ Reachability Tree
9 | - ✅ With Simple Objects
10 | - ✅ Cyclic Reference
11 | - ✅ Double reference
12 | - ✅ Mark & Sweep
13 | - ✅ Task and Wrap Up
14 |
15 | ## 🫶 Support
16 |
17 | Your support means a lot.
18 |
19 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
20 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
21 |
22 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
23 |
24 | ### 🤝 Sponsor My Work
25 |
26 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
27 |
28 | ## Video
29 |
30 | Here is the video for you to go through and learn:
31 |
32 | [](https://youtu.be/w-ZCIbEU-0A "Video")
33 |
34 | ## **👩💻 🧑💻 Assignment Tasks**
35 |
36 | Please find the task assignments in the [Task File](./task.md).
37 |
--------------------------------------------------------------------------------
/day-35/README.md:
--------------------------------------------------------------------------------
1 | # Day 35 - 40 Days of JavaScript - Fix the Broken Code Challenge
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Debugging
6 | - ✅ Modules 5 and 6
7 | - ✅ Calculate Discount Problem
8 | - ✅ Closure Confusion Problem
9 | - ✅ Unhappy Button Problem
10 | - ✅ Payment Process Problem
11 | - ✅ Tracking Order Problem
12 | - ✅ What’s Next
13 |
14 | ## 🫶 Support
15 |
16 | Your support means a lot.
17 |
18 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
19 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
20 |
21 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
22 |
23 | ### 🤝 Sponsor My Work
24 |
25 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
26 |
27 | ## Video
28 |
29 | Here is the video for you to go through and learn:
30 |
31 | [](https://youtu.be/wjM89QIL5As "Video")
32 |
33 | ## **👩💻 🧑💻 Assignment Tasks**
34 |
35 | Please find the task assignments in the [Task File](./task.md).
36 |
--------------------------------------------------------------------------------
/day-20/README.md:
--------------------------------------------------------------------------------
1 | # Day 20 - 40 Days of JavaScript - Advanced DOM Tips and Tricks
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Intro
6 | - ✅ Efficient DOM Travarsal
7 | - ✅ Template and Cloning
8 | - ✅ Document Fragment
9 | - ✅ Range
10 | - ✅ Shadow DOM
11 | - ✅ Advanced Class Manipulations
12 | - ✅ Handling Large-Scale Updates
13 | - ✅ Mutation Observer
14 |
15 | ## 🫶 Support
16 |
17 | Your support means a lot.
18 |
19 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
20 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
21 |
22 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
23 |
24 | ### 🤝 Sponsor My Work
25 |
26 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
27 |
28 | ## Video
29 |
30 | Here is the video for you to go through and learn:
31 |
32 | [](https://youtu.be/aNhPav1DgTY "Video")
33 |
34 | ## **👩💻 🧑💻 Assignment Tasks**
35 |
36 | Please find the task assignments in the [Task File](./task.md).
37 |
--------------------------------------------------------------------------------
/day-08/README.md:
--------------------------------------------------------------------------------
1 | # Day 08 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Welcome to Module 2
6 | - ✅ Why Execution Context
7 | - ✅ Lexical Environment
8 | - ✅ Execution Context
9 | - ✅ Global Execution Context
10 | - ✅ Function Execution Context
11 | - ✅ GEC and FEC With Complex Examples
12 | - ✅ Memory Management With Call Stack and Heap
13 | - ✅ Task for YOU!
14 |
15 | ## 🫶 Support
16 | Your support means a lot.
17 |
18 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
19 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
20 |
21 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
22 |
23 | ### 🤝 Sponsor My Work
24 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
25 |
26 | ## Video
27 | Here is the video for you to go through and learn:
28 |
29 | [](https://youtu.be/ylx5F7hbzVQ "Video")
30 |
31 | ## **👩💻 🧑💻 Assignment Tasks**
32 |
33 | Please find the task assignments in the [Task File](./task.md).
34 |
--------------------------------------------------------------------------------
/day-37/README.md:
--------------------------------------------------------------------------------
1 | # Day 37 - JavaScript Web APIs
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ What are We Learning?
6 | - ✅ What are Web APIs?
7 | - ✅ How Web APIs Work?
8 | - ✅ Web APIS Marketplace
9 | - ✅ Copy to Clipboard
10 | - ✅ Local Storage
11 | - ✅ Session Storage
12 | - ✅ Geolocation
13 | - ✅ Build It
14 | - ✅ Open Source Web API Playground
15 | - ✅ Before We End
16 |
17 | ## 🫶 Support
18 |
19 | Your support means a lot.
20 |
21 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
22 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
23 |
24 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
25 |
26 | ### 🤝 Sponsor My Work
27 |
28 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
29 |
30 | ## Video
31 |
32 | Here is the video for you to go through and learn:
33 |
34 | [](https://youtu.be/Ffpd8RkEXlY "Video")
35 |
36 | ## **👩💻 🧑💻 Assignment Tasks**
37 |
38 | Please find the task assignments in the [Task File](./task.md).
39 |
--------------------------------------------------------------------------------
/day-21/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | box-sizing: border-box;
3 | font-family: "Segoe UI", sans-serif;
4 | }
5 |
6 | body {
7 | margin: 0;
8 | padding: 0;
9 | background-color: #1e1e2f;
10 | color: #f0f0f0;
11 | display: flex;
12 | justify-content: center;
13 | align-items: center;
14 | height: 100vh;
15 | }
16 |
17 | .quiz-box {
18 | background: #2a2a40;
19 | padding: 3px;
20 | border-radius: 16px;
21 | width: 90%;
22 | max-width: 500px;
23 | text-align: center;
24 | box-shadow: 0 8px 16px rgba(0,0,0,0.3);
25 | }
26 |
27 | #question {
28 | margin-bottom: 20px;
29 | }
30 |
31 | .options {
32 | display: flex;
33 | flex-direction: column;
34 | gap: 10px;
35 | margin-bottom: 20px;
36 | }
37 |
38 | #next-btn {
39 | padding: 10px 20px;
40 | border: none;
41 | background: #4b6cb7;
42 | color: white;
43 | border-radius: 10px;
44 | cursor: pointer;
45 | font-size: 16px;
46 | }
47 |
48 | #timer {
49 | font-size: 20px;
50 | margin-bottom: 10px;
51 | color: #ffcc00;
52 | }
53 |
54 | .option-btn {
55 | padding: 12px;
56 | background: #38385e;
57 | border: none;
58 | border-radius: 8px;
59 | color: white;
60 | cursor: pointer;
61 | transition: background 0.3s ease;
62 | }
63 |
64 | .option-btn:hover {
65 | background: #4b4b7e;
66 | }
67 |
68 | .option-btn.correct {
69 | background-color: #3cb371;
70 | }
71 | .option-btn.wrong {
72 | background-color: #e74c3c;
73 | }
74 |
--------------------------------------------------------------------------------
/day-36/README.md:
--------------------------------------------------------------------------------
1 | # Day 36 - JavaScript Performance Optimization Techniques
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Important Updates
6 | - ✅ What is Performance?
7 | - ✅ Debouncing in JavaScript
8 | - ✅ Throttling in JavaScript
9 | - ✅ Memoization in JavaScript
10 | - ✅ Memory Leak in JavaScript
11 | - ✅ DOM Performance
12 | - ✅ Over Optimization
13 | - ✅ Before We End
14 |
15 | ## 🫶 Support
16 |
17 | Your support means a lot.
18 |
19 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
20 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
21 |
22 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
23 |
24 | ### 🤝 Sponsor My Work
25 |
26 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
27 |
28 | ## Video
29 |
30 | Here is the video for you to go through and learn:
31 |
32 | [](https://youtu.be/RnQPMARiq18 "Video")
33 |
34 | ## **👩💻 🧑💻 Assignment Tasks**
35 |
36 | Please find the task assignments in the [Task File](./task.md).
37 |
--------------------------------------------------------------------------------
/day-11/README.md:
--------------------------------------------------------------------------------
1 | # Day 11 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Day 11
6 | - ✅ What is Closure in JavaScript?
7 | - ✅ Understanding Closure With Lexical Scope
8 | - ✅ Closure Memorizing Outer Values
9 | - ✅ Closure Real World Use Case
10 | - ✅ Function Factory With Closure
11 | - ✅ Closure & Memory Leak
12 | - ✅ Advantages of Closure
13 | - ✅ Closure & Event Handlers
14 |
15 | ## 🫶 Support
16 |
17 | Your support means a lot.
18 |
19 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
20 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
21 |
22 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
23 |
24 | ### 🤝 Sponsor My Work
25 |
26 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
27 |
28 | ## Video
29 |
30 | Here is the video for you to go through and learn:
31 |
32 | [](https://youtu.be/lA7CGz3iHyI "Video")
33 |
34 | ## **👩💻 🧑💻 Assignment Tasks**
35 |
36 | Please find the task assignments in the [Task File](./task.md).
37 |
--------------------------------------------------------------------------------
/day-32/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
6 |
7 | ## 1. Split a Utility Library
8 |
9 | Create a small utility library (e.g., math functions like add, subtract, multiply, divide) in separate module files and import them into a main index.js file to perform operations.
10 |
11 | ## 2. Create a Feature-Based Module Structure
12 |
13 | Create a small blog app where:
14 |
15 | - post.js handles posts
16 | - user.js handles user info
17 | - main.js brings it together via import
18 |
19 | ## 3. Use Named vs Default Exports
20 |
21 | Create modules with both named and default exports, and demonstrate:
22 |
23 | - How to import them correctly
24 | - How to rename named exports during import
25 |
26 | ## 4. Mock an API Module
27 |
28 | Create api.js that exports functions like fetchUsers, createUser, etc.
29 |
30 | - Simulate network delays using setTimeout
31 | - Use these in a frontend to display mock data
32 |
33 | ## 5. Quiz App Modularized
34 |
35 | Modularize a quiz app:
36 |
37 | - questions.js: array of questions
38 | - quizLogic.js: handles quiz flow
39 | - ui.js: handles DOM updates
40 | - main.js: runs everything
41 |
--------------------------------------------------------------------------------
/day-02/index.js:
--------------------------------------------------------------------------------
1 | console.log("Day 02");
2 |
3 | // Variables: Variables are used to store data in JavaScript
4 |
5 | // - `var`: Function-scoped, can be redeclared (not recommended)
6 | // - `let`: Block-scoped, can be reassigned
7 | // - `const`: Block-scoped, **cannot** be reassigned
8 |
9 | const address = "Bangalore";
10 |
11 | console.log(address);
12 |
13 | // address = "USA";
14 |
15 | // console.log(address);
16 |
17 | let age = 12;
18 |
19 | age = 52;
20 |
21 | let name, salary, department;
22 |
23 | salary = null;
24 |
25 | /*
26 | - **Primitive Data Types:**
27 | - `String` - Text values ("Hello")
28 | - `Number` - Numeric values (25, 3.14)
29 | - `Boolean` - True/False (true, false)
30 | - `Undefined` - A variable declared but not assigned (let x;)
31 | - `Null` - Represents "nothing" (let y = null;)
32 | - `BigInt` - Large numbers (BigInt(12345678901234567890))
33 | - `Symbol` - Unique identifiers (Symbol("id"))
34 | - **Non-Primitive (Reference) Data Types:**
35 | - `Object` - Collection of key-value pairs
36 | - `Array` - Ordered list of values
37 | - `Function` - Code that can be executed
38 | */
39 |
40 | let student = {
41 | name: "Alice",
42 | age: 22,
43 | isEnrolled: true
44 | };
45 | console.log(student.name); // Output: Alice
46 |
47 | let arr = [1,2,4,5]
48 |
49 |
50 | let a = 10;
51 | let b = a; // 10
52 | b = 20; // 20
53 | console.log(a); // 10 (original remains unchanged)
54 |
--------------------------------------------------------------------------------
/day-29/README.md:
--------------------------------------------------------------------------------
1 | # Day 29 - 40 Days of JavaScript - OOP Concepts
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Welcome to Module 5
6 | - ✅ Things to Learn Today
7 | - ✅ Objects
8 | - ✅ Classes
9 | - ✅ Functions
10 | - ✅ Object Oriented Programming(OOP)
11 | - ✅ Real-world Examples of OOP
12 | - ✅ Abstraction
13 | - ✅ Encapsulation
14 | - ✅ Inheritance
15 | - ✅ Polymorphism
16 | - ✅ Composition
17 | - ✅ Quick Recap
18 |
19 | ## 🫶 Support
20 |
21 | Your support means a lot.
22 |
23 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
24 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
25 |
26 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
27 |
28 | ### 🤝 Sponsor My Work
29 |
30 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
31 |
32 | ## Video
33 |
34 | Here is the video for you to go through and learn:
35 |
36 | [](https://www.youtube.com/watch?v=oRQOiyO-kHg "Video")
37 |
38 | ## **👩💻 🧑💻 Assignment Tasks**
39 |
40 | Please find the task assignments in the [Task File](./task.md).
41 |
--------------------------------------------------------------------------------
/day-39/README.md:
--------------------------------------------------------------------------------
1 | # Day 39 - JavaScript Interview Prep Guide
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Why this Video is Essential?
6 | - ✅ The Plan
7 | - ✅ Top Interview Suggestions
8 | - ✅ Freshers
9 | - ✅ Mid-Levels
10 | - ✅ Senior Developers
11 | - ✅ Tech Leads/Architects
12 | - ✅ Problem Types
13 | - ✅ Common Mistakes
14 | - ✅ How to Think Logically?
15 | - ✅ Machine Coding Round
16 | - ✅ Dos and Don’ts in Machine Coding Round
17 | - ✅ Machine Coding Challenge
18 | - ✅ The Hidden Power
19 | - ✅ Confidence & Communication
20 | - ✅ Recap & What’s next
21 |
22 | ## 🫶 Support
23 |
24 | Your support means a lot.
25 |
26 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
27 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
28 |
29 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
30 |
31 | ### 🤝 Sponsor My Work
32 |
33 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
34 |
35 | ## Video
36 |
37 | Here is the video for you to go through and learn:
38 |
39 | [](https://youtu.be/aCJUoYWwAj8 "Video")
40 |
--------------------------------------------------------------------------------
/day-40/splitter/src/main.js:
--------------------------------------------------------------------------------
1 | import { UserService } from "./services/userService";
2 | import { ExpenseService } from "./services/expenseService";
3 | import { StorageService } from "./services/storageService";
4 | import { ExpenseUI } from "./ui/expenseUI";
5 | import { showErrorToast } from "./utils/toastUtil";
6 | class ExpenseApp {
7 | constructor() {
8 | this.userService = new UserService();
9 | this.expenseService = new ExpenseService(this.userService);
10 | this.storageService = new StorageService(this.userService, this.expenseService);
11 | this.ui = null;
12 | }
13 |
14 | init() {
15 | try {
16 | this.ui = new ExpenseUI(this.userService, this.expenseService, this.storageService);
17 | console.log('Expense Splitter App initialized successfully');
18 | } catch (error) {
19 | console.error('Failed to initialize app:', error);
20 | showErrorToast('Failed to initialize application');
21 | }
22 | }
23 | }
24 |
25 | // Global app instance
26 | let expenseApp;
27 |
28 | // Initialize the application when DOM is ready
29 | document.addEventListener('DOMContentLoaded', () => {
30 | expenseApp = new ExpenseApp();
31 | expenseApp.init();
32 | });
33 |
34 | // Wait for Toastify to load if it's loaded asynchronously
35 | window.addEventListener('load', () => {
36 | if (!expenseApp) {
37 | expenseApp = new ExpenseApp();
38 | expenseApp.init();
39 | }
40 | });
--------------------------------------------------------------------------------
/day-40/splitter/src/services/userService.js:
--------------------------------------------------------------------------------
1 | import { User } from "../models/user";
2 |
3 | export class UserService {
4 | constructor() {
5 | this.users = new Map();
6 | }
7 |
8 | addUser(name) {
9 | if (!name) {
10 | throw new Error('User name is required');
11 | }
12 |
13 | const trimmedName = name.trim();
14 | if (this.users.has(trimmedName)) {
15 | throw new Error('User already exists');
16 | }
17 |
18 | const user = new User(trimmedName);
19 | this.users.set(trimmedName, user);
20 | return user;
21 | }
22 |
23 | getUser(name) {
24 | return this.users.get(name);
25 | }
26 |
27 | getAllUsers() {
28 | return Array.from(this.users.values());
29 | }
30 |
31 | getUserNames() {
32 | return Array.from(this.users.keys());
33 | }
34 |
35 | hasUser(name) {
36 | return this.users.has(name);
37 | }
38 |
39 | getUserCount() {
40 | return this.users.size;
41 | }
42 |
43 | clear() {
44 | this.users.clear();
45 | }
46 |
47 | importUsers(userData) {
48 | if (!Array.isArray(userData)) {
49 | throw new Error('User data must be an array');
50 | }
51 |
52 | userData.forEach(userData => {
53 | if (userData && userData.name) {
54 | this.users.set(userData.name, new User(userData.name));
55 | }
56 | });
57 | }
58 | }
--------------------------------------------------------------------------------
/day-03/README.md:
--------------------------------------------------------------------------------
1 | # Day 03 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - What are Operands, Operators, Expressions?
6 | - What are difefrent types of Operators?
7 | - Arithmetic Operators
8 | - Assignment Operators
9 | - Comparison Operators
10 | - Logical Operators
11 | - Conditional Ternary Operator
12 | - Bitwise Operator
13 | - Relational Operator
14 | - Grouping and Precedence
15 | - typeof Operator
16 | - instanceof Operator
17 | - Tasks and Practices
18 |
19 | ## 🫶 Support
20 | Your support means a lot.
21 |
22 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
23 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
24 |
25 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
26 |
27 | ### 🤝 Sponsor My Work
28 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
29 |
30 | ## Video
31 | Here is the video for you to go through and learn:
32 |
33 | [](https://youtu.be/vI95K-_JLOw "Video")
34 |
35 | ## **👩💻 🧑💻 Assignment Tasks**
36 |
37 | Please find the task assignments in the [Task File](./task.md).
--------------------------------------------------------------------------------
/day-05/README.md:
--------------------------------------------------------------------------------
1 | # Day 05 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Logic Building and DSA
6 | - ✅ Loops in JavaScript
7 | - ✅ The for Loop
8 | - ✅ The for Loop Flow Chart
9 | - ✅ for Loop Examples
10 | - ✅ Nested Loop
11 | - ✅ The break and continue
12 | - ✅ Handling Multiple Counters
13 | - ✅ The while Loop
14 | - ✅ The do-while Loop
15 | - ✅ Infinite Loop
16 | - ✅ Task and Wrap Up
17 |
18 | ## 🫶 Support
19 | Your support means a lot.
20 |
21 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
22 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
23 |
24 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
25 |
26 | ### 🤝 Sponsor My Work
27 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
28 |
29 | ## Video
30 | Here is the video for you to go through and learn:
31 |
32 | [](https://www.youtube.com/watch?v=MDR43-2GvtA&list=PLIJrr73KDmRw2Fwwjt6cPC_tk5vcSICCu&index=5 "Video")
33 |
34 | ## **👩💻 🧑💻 Assignment Tasks**
35 |
36 | Please find the task assignments in the [Task File](./task.md).
37 |
--------------------------------------------------------------------------------
/day-13/README.md:
--------------------------------------------------------------------------------
1 | # Day 13 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Welcome to Day 13
6 | - ✅ What is “this”?
7 | - ✅ this in Global
8 | - ✅ Implicit Binding
9 | - ✅ this Inside an Arrow Function
10 | - ✅ Explicit Binding
11 | - ✅ The call() method
12 | - ✅ The apply() method
13 | - ✅ The bind() method
14 | - ✅ The new Keyword and this Keyword
15 | - ✅ A Quick Recap
16 | - ✅ Interview Questions and Answers
17 | - ✅ Task and What’s Next?
18 |
19 | ## 🫶 Support
20 |
21 | Your support means a lot.
22 |
23 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
24 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
25 |
26 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
27 |
28 | ### 🤝 Sponsor My Work
29 |
30 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
31 |
32 | ## Video
33 |
34 | Here is the video for you to go through and learn:
35 |
36 | [](https://youtu.be/9mfb0j9PcHw "Video")
37 |
38 | ## **👩💻 🧑💻 Assignment Tasks**
39 |
40 | Please find the task assignments in the [Task File](./task.md).
41 |
--------------------------------------------------------------------------------
/day-14/README.md:
--------------------------------------------------------------------------------
1 | # Day 14 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Why Error Handling
6 | - ✅ What Will We Learn?
7 | - ✅ Errors in JavaScript
8 | - ✅ Handling Errors With try and catch
9 | - ✅ The Error Object
10 | - ✅ Real World Use Cases
11 | - ✅ Throwing Error
12 | - ✅ A Few More Error Cases
13 | - ✅ Rethrowing Error
14 | - ✅ The finally
15 | - ✅ Custom Errors
16 | - ✅ The Self Assignment Operator(dream so far!)
17 | - ✅ Task and What’s Next?
18 |
19 | ## 🫶 Support
20 |
21 | Your support means a lot.
22 |
23 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
24 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
25 |
26 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
27 |
28 | ### 🤝 Sponsor My Work
29 |
30 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
31 |
32 | ## Video
33 |
34 | Here is the video for you to go through and learn:
35 |
36 | [](https://youtu.be/XpMW-gxNYD8 "Video")
37 |
38 | ## **👩💻 🧑💻 Assignment Tasks**
39 |
40 | Please find the task assignments in the [Task File](./task.md).
41 |
--------------------------------------------------------------------------------
/day-24/weather/index.js:
--------------------------------------------------------------------------------
1 |
2 | // Get the API Key from here: https://openweathermap.org/api
3 | const API_KEY = "";
4 |
5 | const queryWeather = async (city) => {
6 | try {
7 | showLoading();
8 | const res = await fetch(
9 | `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${API_KEY}&units=metric`
10 | );
11 |
12 | if (!res.ok) throw new Error("City not found");
13 |
14 | const data = await res.json();
15 | displayWeather(data);
16 | } catch (err) {
17 | showError(err.message);
18 | } finally {
19 | hideLoading();
20 | }
21 | };
22 |
23 | document.querySelector('#searchBtn').addEventListener('click', () => {
24 | const city = document.querySelector('#cityInput').value;
25 | if (city) {
26 | queryWeather(city);
27 | }
28 | });
29 |
30 | function showLoading() {
31 | document.querySelector('#loading').innerHTML = '⏳ Loading...';
32 | }
33 |
34 | function hideLoading() {
35 | document.querySelector('#loading').innerHTML = '';
36 | }
37 |
38 | function displayWeather(data) {
39 | const html = `
40 |
`;
50 | }
--------------------------------------------------------------------------------
/day-06/README.md:
--------------------------------------------------------------------------------
1 | # Day 06 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ What Will We Learn
6 | - ✅ What is Function
7 | - ✅ Define a Function
8 | - ✅ Invoking a Function
9 | - ✅ Function as Expression
10 | - ✅ Parameter and Argument
11 | - ✅ Default Parameters
12 | - ✅ Rest parameter
13 | - ✅ Nested Functions
14 | - ✅ Callback Function
15 | - ✅ Pure Function
16 | - ✅ Higher Order Function
17 | - ✅ Arrow Function
18 | - ✅ IIFE
19 | - ✅ Call Stack
20 | - ✅ Recursion
21 | - ✅ Task and Wrap Up
22 |
23 | ## 🫶 Support
24 | Your support means a lot.
25 |
26 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
27 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
28 |
29 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
30 |
31 | ### 🤝 Sponsor My Work
32 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
33 |
34 | ## Video
35 | Here is the video for you to go through and learn:
36 |
37 | [](https://www.youtube.com/watch?v=6UJ9SyHvkJY "Video")
38 |
39 | ## **👩💻 🧑💻 Assignment Tasks**
40 |
41 | Please find the task assignments in the [Task File](./task.md).
42 |
--------------------------------------------------------------------------------
/day-02/README.md:
--------------------------------------------------------------------------------
1 | # Day 02 - 40 Days of JavaScript
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - What is Variable?
6 | - How to visialize variables?
7 | - How Variables get stored?
8 | - JavaScript Data Types
9 | - How JavaScript sees code?
10 |
11 | ## 🫶 Support
12 | Your support means a lot.
13 |
14 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
15 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
16 |
17 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
18 |
19 | ### 🤝 Sponsor My Work
20 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
21 |
22 | ## Video
23 | Here is the video for you to go through and learn:
24 |
25 | [](https://www.youtube.com/watch?v=tVqy4Tw0i64 "Video")
26 |
27 | ## **👩💻 🧑💻 Assignment Tasks**
28 |
29 | - ✅ Task 1: Declare variables for a person’s name, age, isStudent status, and favorite programming language.
30 | - ✅ Task 2: Print the values to the console.
31 | - ✅ Task 3: Try reassigning values to let and const variables and observe errors.
32 | - ✅ Task 4: Create an object and an array, assign them to new variables, modify, and observe changes.
33 |
--------------------------------------------------------------------------------
/day-16/README.md:
--------------------------------------------------------------------------------
1 | # Day 16 - 40 Days of JavaScript - JavaScript Debugging
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Introduction
6 | - ✅ What is Debugging?
7 | - ✅ Application to Debug
8 | - ✅ The famous console.log
9 | - ✅ DevTools Overview
10 | - ✅ The Source Panel
11 | - ✅ Setting Debug Points
12 | - ✅ Debugging Code
13 | - ✅ Conditional Breakpoint
14 | - ✅ Debug Handlers
15 | - ✅ Debug DOM Changes
16 | - ✅ The "debugger" Handle
17 | - ✅ Debugging Scope
18 | - ✅ Observing Call Stack
19 | - ✅ Watching Variable Expressions
20 | - ✅ Edit and Save on Run Time
21 | - ✅ Workspace
22 | - ✅ Debugguing with VS Code
23 | - ✅ A Few Debugging Tips
24 |
25 | ## 🫶 Support
26 |
27 | Your support means a lot.
28 |
29 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
30 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
31 |
32 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
33 |
34 | ### 🤝 Sponsor My Work
35 |
36 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
37 |
38 | ## Video
39 |
40 | Here is the video for you to go through and learn:
41 |
42 | [](https://youtu.be/VInAd-GJZec "Video")
43 |
--------------------------------------------------------------------------------
/day-17/README.md:
--------------------------------------------------------------------------------
1 | # Day 17 - 40 Days of JavaScript - Intro to JavaScript DOM
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Module 3 & DOM
6 | - ✅ Expense Tracker Project
7 | - ✅ What is DOM?
8 | - ✅ DOM and JavaScript
9 | - ✅ What else to Cover?
10 | - ✅ DOM Types
11 | - ✅ Accessing DOM
12 | - ✅ Get Element By ID
13 | - ✅ Get Element By Class Name
14 | - ✅ Get Element By Tag Name
15 | - ✅ Query Selector
16 | - ✅ Query Selector All
17 | - ✅ Mini Project 1
18 | - ✅ Mini Project 2
19 | - ✅ About Task
20 | - ✅ Playing With DOM on DevTools
21 |
22 | ## 🫶 Support
23 |
24 | Your support means a lot.
25 |
26 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
27 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
28 |
29 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
30 |
31 | ### 🤝 Sponsor My Work
32 |
33 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
34 |
35 | ## Video
36 |
37 | Here is the video for you to go through and learn:
38 |
39 | [](https://youtu.be/F4mVSaj6uls "Video")
40 |
41 | ## **👩💻 🧑💻 Assignment Tasks**
42 |
43 | Please find the task assignments in the [Task File](./task.md).
44 |
--------------------------------------------------------------------------------
/day-11/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
3 |
4 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
5 |
6 | ## 1. What will be the output of the following code and why?
7 | ```js
8 | function outer() {
9 | let count = 0;
10 | return function inner() {
11 | count++;
12 | console.log(count);
13 | };
14 | }
15 | const counter = outer();
16 | counter();
17 | counter();
18 | ```
19 |
20 | ## 2. What will be the output and why?
21 | ```js
22 | function testClosure() {
23 | let x = 10;
24 | return function () {
25 | return x * x;
26 | };
27 | }
28 | console.log(testClosure()());
29 | ```
30 |
31 | ## 3. Create a button dynamically and attach a click event handler using a closure. The handler should count and log how many times the button was clicked.
32 |
33 | ## 4. Write a function `createMultiplier(multiplier)` that returns another function to multiply numbers.
34 |
35 | ## 5. What happens if a closure references an object?
36 | - 1) The object is garbage collected immediately
37 | - 2) The object remains in memory as long as the closure exists
38 | - 3) The object is automatically cloned
39 | - 4) None of the Above.
40 |
41 | ## 6. Write a function factory of counter to increment, decrement, and reset a counter. Use closure to refer the count value across the functuions.
42 |
--------------------------------------------------------------------------------
/day-30/README.md:
--------------------------------------------------------------------------------
1 | # Day 30 - 40 Days of JavaScript - Classes and OOP
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Intro
6 | - ✅ What Will We Learn?
7 | - ✅ What is a Class?
8 | - ✅ ES6 Classes - Syntax
9 | - ✅ Initialize Objects 09:40 - “this” in Classes
10 | - ✅ The Type of Class
11 | - ✅ Class as Expression 19:08 - Class Fields
12 | - ✅ Getters and Setters
13 | - ✅ Static Properties
14 | - ✅ Private and Public Fields
15 | - ✅ Extending Class
16 | - ✅ Abstraction
17 | - ✅ Encapsulation
18 | - ✅ Inheritance
19 | - ✅ Polymorphism
20 | - ✅ Composition
21 | - ✅ What’s Next?
22 |
23 | ## 🫶 Support
24 |
25 | Your support means a lot.
26 |
27 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
28 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
29 |
30 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
31 |
32 | ### 🤝 Sponsor My Work
33 |
34 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
35 |
36 | ## Video
37 |
38 | Here is the video for you to go through and learn:
39 |
40 | [](https://youtu.be/kG5t34ciG9w "Video")
41 |
42 | ## **👩💻 🧑💻 Assignment Tasks**
43 |
44 | Please find the task assignments in the [Task File](./task.md).
45 |
--------------------------------------------------------------------------------
/day-19/README.md:
--------------------------------------------------------------------------------
1 | # Day 19 - 40 Days of JavaScript - JavaScript Events
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ What Will We Learn Today?
6 | - ✅ What is an Event?
7 | - ✅ Event Handling in markup
8 | - ✅ Event Handling in Script
9 | - ✅ addEventListener
10 | - ✅ removeEventListener
11 | - ✅ Handling Multiple Listeners
12 | - ✅ DOM Content Loaded
13 | - ✅ Anatomy of Event Object
14 | - ✅ Event Bubbling
15 | - ✅ Event Capturing
16 | - ✅ Event Delegation
17 | - ✅ Stop Propagation
18 | - ✅ Preventing Defaults
19 | - ✅ Custom Events
20 | - ✅ Project - FAQ
21 | - ✅ The Task and Wrap Up
22 |
23 | ## 🫶 Support
24 |
25 | Your support means a lot.
26 |
27 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
28 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
29 |
30 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
31 |
32 | ### 🤝 Sponsor My Work
33 |
34 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
35 |
36 | ## Video
37 |
38 | Here is the video for you to go through and learn:
39 |
40 | [](https://youtu.be/ybgI5vVE668 "Video")
41 |
42 | ## **👩💻 🧑💻 Assignment Tasks**
43 |
44 | Please find the task assignments in the [Task File](./task.md).
45 |
--------------------------------------------------------------------------------
/day-25/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
6 |
7 | ## 1. Use `fetch()` to retrieve a list of users from `https://jsonplaceholder.typicode.com/users` and log the names to the console
8 |
9 | ## 2. Fetch all posts by userId=1 from `https://jsonplaceholder.typicode.com/posts?userId=1` and display the titles in the DOM
10 |
11 | ## 3. Send a `POST` request to `https://jsonplaceholder.typicode.com/posts` with a new post (title, body, userId). Show the response in console
12 |
13 | ## 4. Update the post with `ID = 1` by sending a `PUT` request with a new title and body. Use the same endpoint
14 |
15 | ## 5. Send a `PATCH` request to update just the title of post `ID = 1`
16 |
17 | ## 6. Send a `DELETE` request to remove post with `ID = 1`. Log the status of the response
18 |
19 | ## 7. Send a POST request to `https://jsonplaceholder.typicode.com/posts` with `Content-Type: application/json` in headers. Log the response
20 |
21 | ## 8. Create a custom function `request(url, options)` that wraps fetch. Use it to `GET` users and `POST` a new post
22 |
23 | ## 9. Make a fetch call to a broken URL and use `.catch()` or `try...catch` to show a user-friendly error message
24 |
25 | ## 10. Use `AbortController` to cancel a long-running fetch request (you can delay the response using a mock server or setTimeout)
26 |
--------------------------------------------------------------------------------
/day-34/README.md:
--------------------------------------------------------------------------------
1 | # Day 34 - 40 Days of JavaScript - Library Management System(LMS)
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ What are We Building?
6 | - ✅ Library Management System
7 | - ✅ Applying OOP
8 | - ✅ Project Setup
9 | - ✅ HTML: The View Switcher
10 | - ✅ HTML: Add Book Form
11 | - ✅ HTML: Available Books
12 | - ✅ HTML: Borrowed Books
13 | - ✅ JS: Modules & Classes
14 | - ✅ JS: Role-Based Views
15 | - ✅ JS: Add Books
16 | - ✅ JS: Services
17 | - ✅ JS: Render All Books
18 | - ✅ JS: Event Bubbling
19 | - ✅ JS: Borrow Tracking
20 | - ✅ JS: Render Borrowed Books
21 | - ✅ Task Assignments
22 |
23 | ## 🫶 Support
24 |
25 | Your support means a lot.
26 |
27 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
28 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
29 |
30 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
31 |
32 | ### 🤝 Sponsor My Work
33 |
34 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
35 |
36 | ## Video
37 |
38 | Here is the video for you to go through and learn:
39 |
40 | [](https://youtu.be/DXO8tiGH18Y "Video")
41 |
42 | ## **👩💻 🧑💻 Assignment Tasks**
43 |
44 | Please find the task assignments in the [Task File](./task.md).
45 |
--------------------------------------------------------------------------------
/project-assignment/expense-tracker.md:
--------------------------------------------------------------------------------
1 | # Expense Tracker Project
2 |
3 | You have just finished the module 2. You have learned many important concepts till the session(day) 16. It is time to put everything together and do a project.
4 |
5 | ## Project Requirements
6 |
7 | Create a simple expense tracker where user can add, remove, edit, and categorize expenses.
8 |
9 | > Please Note: This will be a console-based project (no DOM), focusing only on JavaScript logic.
10 |
11 | ### Features to Implement
12 |
13 | Create a `createExpenseTracker()` function that takes a username and an initial budget to expose the following functioanlities:
14 |
15 | - Adding Expense
16 | - Removing Expense
17 | - Updating Expense
18 | - Getting total expenses done by the user
19 | - Getting expense by category
20 | - Get the Highest Expense
21 | - Get the Lowest Expense
22 | - Get the user info
23 | - Show all the expenses
24 | - Update User data
25 |
26 | Please make use of the factory function, closure to keep data private and return only the required features/methods.
27 |
28 | ## Sample User Data Structure
29 |
30 | ```js
31 | user: {
32 | name: "Tapas",
33 | budget: 5000,
34 | },
35 | ```
36 |
37 | ## Sample Expense Data Structure
38 |
39 | ```js
40 | expenses: [
41 | { id: 1, amount: 200, category: "Food", description: "Lunch" },
42 | { id: 2, amount: 500, category: "Shopping", description: "New Shoes" },
43 | ],
44 | ```
45 |
46 | ## Discussion and Follow up
47 |
48 | Once done, submit the GitHub link on [Discord](https://discord.com/invite/ux9BchWEW3). Please feel free to discuss about the tasks, if you need help. Also, help others to complete it.
49 |
--------------------------------------------------------------------------------
/day-39/index.js:
--------------------------------------------------------------------------------
1 | // What will we DO today
2 |
3 | // 1. Build Confidence in Solving real JavaScript interview questions.
4 | // 2. Learn how to communicate thought processes clearly.
5 | // 3. Understand core concepts deeply (not just surface-level syntax).
6 | // 4. Practice hands-on machine coding rounds.
7 | // 5. Develop debugging, optimization, and refactoring skills.
8 |
9 |
10 | // Not so good implementation
11 |
12 | let todos = [];
13 |
14 | function addTodo() {
15 | const val = document.getElementById("todo-input").value;
16 | todos.push(val);
17 | localStorage.setItem("todos", JSON.stringify(todos));
18 | document.getElementById("list").innerHTML += `
${val}
`;
19 | }
20 |
21 | // Good Implemenatation
22 |
23 | class TodoApp {
24 | constructor() {
25 | this.todos = JSON.parse(localStorage.getItem('todos')) || [];
26 | this.input = document.getElementById('todo-input');
27 | this.list = document.getElementById('list');
28 | document.getElementById('add-btn').addEventListener('click', () => this.addTodo());
29 | this.render();
30 | }
31 |
32 | addTodo() {
33 | const val = this.input.value.trim();
34 | if (!val) return alert('Todo cannot be empty');
35 | this.todos.push(val);
36 | this.saveAndRender();
37 | }
38 |
39 | saveAndRender() {
40 | localStorage.setItem('todos', JSON.stringify(this.todos));
41 | this.render();
42 | }
43 |
44 | render() {
45 | this.list.innerHTML = '';
46 | this.todos.forEach(todo => {
47 | const li = document.createElement('li');
48 | li.textContent = todo;
49 | this.list.appendChild(li);
50 | });
51 | }
52 | }
53 |
54 | new TodoApp();
--------------------------------------------------------------------------------
/day-31/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
6 |
7 | ## 1. Create a Simple Prototype Chain
8 |
9 | - Define a base object animal with a method eat.
10 | - Create another object dog that inherits from animal using Object.create.
11 | - Call eat from dog and explain how the prototype chain resolves it.
12 |
13 | ## 2. Build a Custom Constructor Function
14 |
15 | - Create a constructor function Book(title, author).
16 | - Add a method getDetails() to the prototype of Book.
17 | - Instantiate two books and show they share the method from the prototype.
18 |
19 | ## 3. Compare Object Creation Patterns
20 |
21 | Create three objects using:
22 |
23 | - Object literals
24 | - Constructor functions
25 | - Object.create
26 |
27 | Add similar methods and compare how inheritance works in each pattern.
28 |
29 | ## 4. Simulate a Real-World Inheritance Chain
30 |
31 | - Simulate a real-life hierarchy: Person → Student → GraduateStudent.
32 | - Each level should add its own methods or properties using prototypes.
33 | - Show how a GraduateStudent can access methods from both Student and Person.
34 |
35 | ## 5. Object.create vs Class vs Constructor Function
36 |
37 | - Implement the same User entity using:
38 | - Constructor Function
39 | - ES6 Class
40 | - Object.create
41 | - Write a summary comparing syntax, readability, and prototype behavior.
42 |
--------------------------------------------------------------------------------
/day-24/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
6 |
7 | ## 1. Create a function wait(ms) that returns a promise which resolves after ms milliseconds. Use async/await to log messages before and after the delay
8 |
9 | ## 2. Using async/await, log "One", then after 1 second log "Two", then "Three" after another 2 seconds. No setTimeout outside of promises
10 |
11 | ## 3. Use fetch() with async/await to load a local JSON file (data.json) and display its contents in the console
12 |
13 | ## 4. Use the public API `https://jsonplaceholder.typicode.com/users/1` to fetch and display the user’s name, email, and address on the page
14 |
15 | ## 5. Modify the previous task to handle errors (e.g., wrong URL) and display a user-friendly error message in the DOM
16 |
17 | ## 6. Refactor then/catch to async/await
18 |
19 | ```js
20 | fetch('/api/data')
21 | .then(res => res.json())
22 | .then(data => console.log(data))
23 | .catch(err => console.error(err));
24 | ```
25 |
26 | ## Project Task
27 |
28 | Let's Build a “Movie Explorer” App
29 |
30 | Build an app that lets users search movies using the OMDB API:
31 | `http://www.omdbapi.com/?apikey=yourkey&s=movieName`
32 |
33 | Hints:
34 |
35 | - Input box for search term
36 | - Display movie title, poster, and year
37 | - Show “No results found” if search fails
38 | - Use async/await, DOM manipulation, and try/catch
39 |
--------------------------------------------------------------------------------
/day-35/1-discount/calculateDiscount.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | You are writing a function that calculates a discounted price based on the user’s cart total. But something is going wrong — customers are getting wrong discount values, especially when the cart has exact boundary values.
4 |
5 | Your job is to debug and fix the logic so that the discount system works as intended.
6 |
7 | Requirements:
8 |
9 | - If total >= 500 → discount is 20%
10 | - If total >= 300 → discount is 15%
11 | - If total >= 100 → discount is 10%
12 | - Otherwise, no discount.
13 |
14 | */
15 |
16 | function calculateDiscount(total) {
17 | let discount = 0;
18 |
19 | if (total >= 100) {
20 | discount = 0.10;
21 | } else if (total >= 300) {
22 | discount = 0.15;
23 | } else if (total >= 500) {
24 | discount = 0.20;
25 | }
26 |
27 | return total - total * discount;
28 | }
29 |
30 | // Test Cases
31 | console.log(calculateDiscount(50)); // Expected: 50 (no discount)
32 | console.log(calculateDiscount(150)); // Expected: 135
33 | console.log(calculateDiscount(350)); // Expected: 297.5
34 | console.log(calculateDiscount(600)); // Expected: 480
35 |
36 | /*
37 |
38 | Your Task:
39 |
40 | - Find the bug in the logic.
41 | - Fix it so it calculates the correct discounted price.
42 | - Make sure the discounts apply in correct order of priority.
43 |
44 | */
45 |
46 | /*
47 |
48 | HINT:
49 |
50 | - Think about how if...else if...else blocks are evaluated.
51 | - The first condition that returns true will be executed, and the rest will be ignored.
52 | - Now look at the order of your conditions.
53 | - What happens if the total is 500?
54 | - Is it checking the most specific (highest) discount first?
55 |
56 | */
57 |
58 |
--------------------------------------------------------------------------------
/day-32/README.md:
--------------------------------------------------------------------------------
1 | # Day 32 - 40 Days of JavaScript - Modules
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ What are Modules in JavaScript, and Why to Use?
6 | - ✅ What are Exports and Imports in JavaScript Module?
7 | - ✅ What are Exports and Imports in JavaScript Module?
8 | - ✅ What are Default and Named Module Exports in JavaScript?
9 | - ✅ What are Aliases in JavaScript Module Import?
10 | - ✅ What are Namespaces in JavaScript Module?
11 | - ✅ What is Combined Export in JavaScript Module?
12 | - ✅ What is Dynamic Import in JavaScript Module?
13 | - ✅ How to Handle Multiple Imports Using JavaScript Promise APIs?
14 | - ✅ What is Tree Shaking & How Does It Help?
15 |
16 | ## 🫶 Support
17 |
18 | Your support means a lot.
19 |
20 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
21 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
22 |
23 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
24 |
25 | ### 🤝 Sponsor My Work
26 |
27 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
28 |
29 | ## Video
30 |
31 | Here is the video for you to go through and learn:
32 |
33 | [](https://youtu.be/l50gnBWHmdA "Video")
34 |
35 | ## **👩💻 🧑💻 Assignment Tasks**
36 |
37 | Please find the task assignments in the [Task File](./task.md).
38 |
--------------------------------------------------------------------------------
/day-18/README.md:
--------------------------------------------------------------------------------
1 | # Day 18 - 40 Days of JavaScript - DOM Manipulations
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Module 3 & DOM
6 | - ✅ Intro to DOM Manipulation
7 | - ✅ What Will We Learn?
8 | - ✅ Create Elements
9 | - ✅ Inserting Elements - Before
10 | - ✅ Inserting Elements - After
11 | - ✅ Modify Content - innerHTML
12 | - ✅ Security Risk of innerHTML
13 | - ✅ Modify Content - textContent
14 | - ✅ Removing Elements
15 | - ✅ Travarsing DOM
16 | - ✅ Manipulating Styles
17 | - ✅ Manipulating Classes
18 | - ✅ Working with classLIst
19 | - ✅ Controlling Visibility
20 | - ✅ Project 1 - Toggle Me
21 | - ✅ Project 2 - Task Manager
22 | 0- ✅ Tasks and Wrapping Up
23 |
24 | ## 🫶 Support
25 |
26 | Your support means a lot.
27 |
28 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
29 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
30 |
31 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
32 |
33 | ### 🤝 Sponsor My Work
34 |
35 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
36 |
37 | ## Video
38 |
39 | Here is the video for you to go through and learn:
40 |
41 | [](https://www.youtube.com/watch?v=BoYgn_Mf0hA "Video")
42 |
43 | ## **👩💻 🧑💻 Assignment Tasks**
44 |
45 | Please find the task assignments in the [Task File](./task.md).
46 |
--------------------------------------------------------------------------------
/day-22/README.md:
--------------------------------------------------------------------------------
1 | # Day 22 - 40 Days of JavaScript - Async JavaScript - Callbacks
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Synchronous vs Asynchronous
6 | - ✅ JavaScript is Synchronous
7 | - ✅ Asynchronous JavaScript
8 | - ✅ Callback Functions
9 | - ✅ Dealing With APIs
10 | - ✅ APIs and Callback
11 | - ✅ The Pizza Order App
12 | - ✅ Callback Hell or Callback Pyramid
13 | - ✅ Debugging
14 | - ✅ What’s Next
15 |
16 | ## How to run the API?
17 |
18 | - Open the terminal and change the directory to `api/pizzahub`.
19 | - Then install the depenedencies with `npm install` command.
20 | - Run the API server locally with `npm run start` command.
21 |
22 | The API server will be available on `localhost:3000`.
23 |
24 | ## 🫶 Support
25 |
26 | Your support means a lot.
27 |
28 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
29 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
30 |
31 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
32 |
33 | ### 🤝 Sponsor My Work
34 |
35 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
36 |
37 | ## Video
38 |
39 | Here is the video for you to go through and learn:
40 |
41 | [](https://youtu.be/EtoHtZ8mdWA "Video")
42 |
43 | ## **👩💻 🧑💻 Assignment Tasks**
44 |
45 | Please find the task assignments in the [Task File](./task.md).
46 |
--------------------------------------------------------------------------------
/day-33/README.md:
--------------------------------------------------------------------------------
1 | # Day 33 - 40 Days of JavaScript - Map, Set, WekaMap, WeakSet
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Intro & Topics to Learn
6 | - ✅ Objects and Arrays
7 | - ✅ Object & Array Shortcomings
8 | - ✅ Map
9 | - ✅ Create & Initialize Map
10 | - ✅ Adding Map Entries
11 | - ✅ How to Get Map Value?
12 | - ✅ Map Keys
13 | - ✅ Map Properties & Methods
14 | - ✅ MapIterators
15 | - ✅ Convert Object to Map
16 | - ✅ Convert Map to Object
17 | - ✅ Convert Map to Array
18 | - ✅ Map vs Object
19 | - ✅ Set
20 | - ✅ Create & Initialize Set
21 | - ✅ Set Properties & Methods
22 | - ✅ SetIterator
23 | - ✅ Set and Array
24 | - ✅ Set and Objects
25 | - ✅ Set Theories
26 | - ✅ WeakMap
27 | - ✅ WeakSet
28 | - ✅ Tasks
29 |
30 | ## 🫶 Support
31 |
32 | Your support means a lot.
33 |
34 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
35 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
36 |
37 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
38 |
39 | ### 🤝 Sponsor My Work
40 |
41 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
42 |
43 | ## Video
44 |
45 | Here is the video for you to go through and learn:
46 |
47 | [](https://youtu.be/kzuvppEWm88 "Video")
48 |
49 | ## **👩💻 🧑💻 Assignment Tasks**
50 |
51 | Please find the task assignments in the [Task File](./task.md).
52 |
--------------------------------------------------------------------------------
/day-40/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | ## 1. Export Expenses
6 |
7 | Export the user and expense details in a JSON file when clicking on the export button.
8 |
9 | The example JSON:
10 |
11 | ```json
12 | {
13 | "users": [
14 | {
15 | "id": "user_1754145833768_qjcqq6bin",
16 | "name": "Tapas"
17 | },
18 | {
19 | "id": "user_1754145843849_zjp5a6w0w",
20 | "name": "Bikas"
21 | }
22 | ],
23 | "expenses": [
24 | {
25 | "id": "expense_1754145839607_t30k1nauj",
26 | "paidBy": "Tapas",
27 | "amount": 32,
28 | "description": "3232",
29 | "timestamp": "2025-08-02T14:43:59.607Z"
30 | },
31 | {
32 | "id": "expense_1754145848181_culgo7f1q",
33 | "paidBy": "Bikas",
34 | "amount": 434,
35 | "description": "3434",
36 | "timestamp": "2025-08-02T14:44:08.181Z"
37 | }
38 | ],
39 | "exportDate": "2025-08-02T14:44:14.380Z"
40 | }
41 | ```
42 |
43 | ## 2. Import Expenses
44 |
45 | The Same JSON file should be imported by clicking the import button and populate the expense list, user list select box. Following it, when the split button is clicked, the settlements should take place.
46 |
47 | ## 3. Enhance the UI
48 |
49 | I have added a bunch of styling enhancements to the app. Please check the source code. Learn about thos styling:
50 |
51 | - Animation
52 | - Focus
53 | - Button styling
54 | - ... more
55 |
56 | ## 4. Deploy
57 |
58 | Deploy the improved app on Netlify, Vercel, Render, or any other free services and share the URL on the social media by tagging @tapasadhikary and @tapascript. Cheers!
59 |
60 | Here is the deployed version of the enhanced app we built together in the session:
61 |
--------------------------------------------------------------------------------
/day-24/README.md:
--------------------------------------------------------------------------------
1 | # Day 24 - 40 Days of JavaScript - Async JavaScript - async/await
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Introduction
6 | - ✅ What Will We Learn?
7 | - ✅ Why async/await?
8 | - ✅ The async Keyword
9 | - ✅ The await Keyword
10 | - ✅ Is await synchronous?
11 | - ✅ Error Handling
12 | - ✅ Project - Weather App
13 | - ✅ Top Level await
14 | - ✅ Handling Multiple async/await
15 | - ✅ The pizzahub with async/await
16 | - ✅ Tasks & Project
17 |
18 | ## How to run the API?
19 |
20 | - Open the terminal and change the directory to `api/pizzahub`.
21 | - Then install the depenedencies with `npm install` command.
22 | - Run the API server locally with `npm run start` command.
23 |
24 | The API server will be available on `localhost:3000`.
25 |
26 | ## 🫶 Support
27 |
28 | Your support means a lot.
29 |
30 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
31 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
32 |
33 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
34 |
35 | ### 🤝 Sponsor My Work
36 |
37 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
38 |
39 | ## Video
40 |
41 | Here is the video for you to go through and learn:
42 |
43 | [](https://youtu.be/WQdCffdPPKI "Video")
44 |
45 | ## **👩💻 🧑💻 Assignment Tasks**
46 |
47 | Please find the task assignments in the [Task File](./task.md).
48 |
--------------------------------------------------------------------------------
/day-23/pizzahub/ph.js:
--------------------------------------------------------------------------------
1 | // Returns a shop id
2 | let getShopIds = () => {
3 | const url = `api/pizzahub`;
4 | return query(url);
5 | };
6 |
7 | // Returns a promise with pizza list for a shop
8 | let getPizzaList = (shopId) => {
9 | const url = `api/pizzahub/pizzas/${shopId}`;
10 | return query(url);
11 | };
12 |
13 | // Returns a promise with pizza that matches the customer request
14 | let getMyPizzaWithAddOn = (pizzas, type, name) => {
15 | let myPizza = pizzas.find((pizza) => {
16 | return pizza.type === type && pizza.name === name;
17 | });
18 | const url = `api/pizzahub/beverages/${myPizza.id}`;
19 | return query(url);
20 | };
21 |
22 | // Returns a promise after Placing the order
23 | let performOrder = (result) => {
24 | return query(`api/order`, {
25 | method: "POST",
26 | headers: {
27 | "Content-Type": "application/json",
28 | },
29 | body: JSON.stringify({
30 | pizzaId: result.pizzaId,
31 | beverageId: result.id,
32 | }),
33 | });
34 | };
35 |
36 | // Confirm the order
37 | let confirmOrder = (type, name, createdAt) => {
38 | console.log(
39 | `Your order of ${type} ${name} has been placed at ${new Date(
40 | createdAt
41 | )}!`
42 | );
43 | };
44 |
45 | function orderPizza(type, name) {
46 | getShopIds()
47 | .then((shopIds) => getPizzaList(shopIds[0]))
48 | .then((pizzas) => getMyPizzaWithAddOn(pizzas, type, name))
49 | .then((pizzaWithAddOns) => performOrder(pizzaWithAddOns[0]))
50 | .then((order) => confirmOrder(type, name, order.createdAt))
51 | .catch(function (error) {
52 | console.log(`Bad luck, No Pizza for you today!`);
53 | });
54 | }
55 |
56 | // Call the orderPizza method
57 | orderPizza("veg", "Margherita");
58 |
--------------------------------------------------------------------------------
/day-40/README.md:
--------------------------------------------------------------------------------
1 | # Day 40 - A Complete JavaScript Project
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ What Can You Expect?
6 | - ✅ Thank YOU!
7 | - ✅ Setting the Ground
8 | - ✅ The Requirements
9 | - ✅ Design Breakdown
10 | - ✅ Project Setup
11 | - ✅ Header
12 | - ✅ Add User UI
13 | - ✅ Add Expense UI
14 | - ✅ Expense & Settlement UI
15 | - ✅ Footer
16 | - ✅ Thinking in JavaScript
17 | - ✅ User Model
18 | - ✅ Expense Model
19 | - ✅ User Service
20 | - ✅ Expense Service
21 | - ✅ The Expense UI
22 | - ✅ Initialize UI Element
23 | - ✅ DOM Helpers
24 | - ✅ Bind Events: Add User
25 | - ✅ Testing the Flow
26 | - ✅ Populate Paid By
27 | - ✅ Add a Toaster
28 | - ✅ Add Expense Logic
29 | - ✅ Rendering Expenses
30 | - ✅ Expense Settling Algo
31 | - ✅ Show Settlements
32 | - ✅ Task Assignments
33 | - ✅ Good Bye
34 |
35 | ## 🫶 Support
36 |
37 | Your support means a lot.
38 |
39 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
40 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
41 |
42 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
43 |
44 | ### 🤝 Sponsor My Work
45 |
46 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
47 |
48 | ## Video
49 |
50 | Here is the video for you to go through and learn:
51 |
52 | [](https://youtu.be/ITNaVrDk9G0 "Video")
53 |
54 | ## **👩💻 🧑💻 Assignment Tasks**
55 |
56 | Please find the task assignments in the [Task File](./task.md).
57 |
--------------------------------------------------------------------------------
/day-31/README.md:
--------------------------------------------------------------------------------
1 | # Day 31 - 40 Days of JavaScript - Prototype & Prototype Chain
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ What Can You Expect
6 | - ✅ JavaScript Object Literals Pattern
7 | - ✅ Ways To Extract Values From Objects
8 | - ✅ JavaScript Object and The const Keyword
9 | - ✅ JavaScript Functions vs Methods
10 | - ✅ The Constructor Function Pattern
11 | - ✅ Composing Objects and References
12 | - ✅ Object Prototypes
13 | - ✅ Prototype Chain
14 | - ✅ Constructor Function Visually
15 | - ✅ The "prototype" Property
16 | - ✅ The "prototype" Visually
17 | - ✅ Prototype To Save Memory
18 | - ✅ Prototype Chain(Lookup) Visually
19 | - ✅ JavaScript Class Pattern
20 | - ✅ JavaScript Class Inheritance
21 | - ✅ The Object.create() Pattern
22 | - ✅ How To Get Prototype Of An Object
23 | - ✅ How To Set An Object Prototype
24 | - ✅ The Closing Notes
25 |
26 | ## 🫶 Support
27 |
28 | Your support means a lot.
29 |
30 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
31 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
32 |
33 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
34 |
35 | ### 🤝 Sponsor My Work
36 |
37 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
38 |
39 | ## Video
40 |
41 | Here is the video for you to go through and learn:
42 |
43 | [](https://youtu.be/Uru85QW9zkk "Video")
44 |
45 | ## **👩💻 🧑💻 Assignment Tasks**
46 |
47 | Please find the task assignments in the [Task File](./task.md).
48 |
--------------------------------------------------------------------------------
/api/pizzahub/server.js:
--------------------------------------------------------------------------------
1 | const jsonServer = require('json-server');
2 | const fs = require('fs');
3 | const path = require('path');
4 |
5 | const server = jsonServer.create();
6 | const router = jsonServer.router('db.json');
7 | const middlewares = jsonServer.defaults();
8 |
9 | server.use(middlewares);
10 | server.use(jsonServer.bodyParser);
11 |
12 | // ✅ GET /api/pizzahub → shop IDs
13 | server.get('/api/pizzahub', (req, res) => {
14 | const db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
15 | const pizzas = db.pizzas || [];
16 | const shops = db.shops || {};
17 | const shopIds = [...new Set(pizzas.map(p => p.shopId).filter(shopId => shops[shopId]))];
18 | res.json(shopIds);
19 | });
20 |
21 | // ✅ POST /api/order → create a new order
22 | server.post('/api/order', (req, res) => {
23 | const { pizzaId, beverageId } = req.body;
24 |
25 | if (!pizzaId || !beverageId) {
26 | return res.status(400).json({ error: 'pizzaId and beverageId are required' });
27 | }
28 |
29 | const dbFile = path.join(__dirname, 'db.json');
30 | const db = JSON.parse(fs.readFileSync(dbFile, 'utf-8'));
31 |
32 | const orders = db.orders || [];
33 | const newOrder = {
34 | id: orders.length + 1,
35 | pizzaId,
36 | beverageId,
37 | createdAt: new Date().toISOString()
38 | };
39 |
40 | orders.push(newOrder);
41 | //db.orders = orders;
42 |
43 | //fs.writeFileSync(dbFile, JSON.stringify(db, null, 2), 'utf-8');
44 | res.status(201).json(newOrder);
45 | });
46 |
47 | // ✅ Rewrite routes
48 | server.use(
49 | jsonServer.rewriter({
50 | '/api/pizzahub/pizzas': '/pizzas',
51 | '/api/pizzahub/pizzas/:shopId': '/pizzas?shopId=:shopId',
52 | '/api/pizzahub/beverages/:pizzaid': '/beverages?pizzaId=:pizzaid'
53 | })
54 | );
55 |
56 | server.use(router);
57 |
58 | server.listen(3000, () => {
59 | console.log('✅ JSON Server running at http://localhost:3000');
60 | });
--------------------------------------------------------------------------------
/day-22/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
6 |
7 | ## 1. Pass a function to greet a user and then thank them
8 |
9 | ## 2. Implement a calculator function that accepts two numbers and a callback to perform operations like add, subtract
10 |
11 | ```js
12 | function calculator(a, b, operationCallback) {
13 | // Complete this function
14 | }
15 |
16 | function add(x, y) {
17 | return x + y;
18 | }
19 |
20 | // Test calculator(5, 3, add);
21 | ```
22 |
23 | Also test it with subtract, multiply, divide functions.
24 |
25 | ## 3. Create a delayedMessage function that prints a message after a delay using setTimeout
26 |
27 | ```js
28 | function delayedMessage(message, delay, callback) {
29 | // Your code here
30 | }
31 |
32 | // delayedMessage("Task complete", 2000, () => console.log("Callback Fired!"))
33 | ```
34 |
35 | ## 4. Implement a function that filters numbers in an array based on a condition provided via callback
36 |
37 | ```js
38 | function filterNumbers(arr, conditionCallback) {
39 | // Use loop and callback to return filtered array
40 | }
41 |
42 | // Example: filterNumbers([1, 2, 3, 4], n => n > 2) // should return [3, 4]
43 | ```
44 |
45 | ## 5. Execute a sequence of tasks one after another using callbacks
46 |
47 | ```js
48 | function task1(callback) {
49 | console.log("Task 1 done");
50 | callback();
51 | }
52 |
53 | function task2(callback) {
54 | console.log("Task 2 done");
55 | callback();
56 | }
57 |
58 | function task3() {
59 | console.log("Task 3 done");
60 | }
61 |
62 | // Call them in sequence using nested callbacks
63 | ```
64 |
--------------------------------------------------------------------------------
/day-24/pizzahub/ph.js:
--------------------------------------------------------------------------------
1 | // Returns a shop id
2 | let getShopIds = async () => {
3 | const url = `api/pizzahub`;
4 | return query(url);
5 | };
6 |
7 | // Returns a promise with pizza list for a shop
8 | let getPizzaList = async (shopId) => {
9 | const url = `api/pizzahub/pizzas/${shopId}`;
10 | return query(url);
11 | };
12 |
13 | // Returns a promise with pizza that matches the customer request
14 | let getMyPizzaWithAddOn = async (pizzas, type, name) => {
15 | let myPizza = pizzas.find((pizza) => {
16 | return pizza.type === type && pizza.name === name;
17 | });
18 | const url = `api/pizzahub/beverages/${myPizza.id}`;
19 | return query(url);
20 | };
21 |
22 | // Returns a promise after Placing the order
23 | let performOrder = async (result) => {
24 | return query(`api/order`, {
25 | method: "POST",
26 | headers: {
27 | "Content-Type": "application/json",
28 | },
29 | body: JSON.stringify({
30 | pizzaId: result.pizzaId,
31 | beverageId: result.id,
32 | }),
33 | });
34 | };
35 |
36 | // Confirm the order
37 | let confirmOrder = (type, name, createdAt) => {
38 | console.log(
39 | `Your order of ${type} ${name} has been placed at ${new Date(
40 | createdAt
41 | )}!`
42 | );
43 | };
44 |
45 | async function orderPizza(type, name) {
46 | try {
47 | const shopIds = await getShopIds();
48 | const pizzas = await getPizzaList(shopIds[0]);
49 | const pizzaWithAddOns = await getMyPizzaWithAddOn(pizzas, type, name);
50 | const order = await performOrder(pizzaWithAddOns[0]);
51 |
52 | confirmOrder(type, name, order.createdAt);
53 | } catch (error) {
54 | console.log(`Bad luck, No Pizza for you today! ${error}`);
55 | }
56 | }
57 |
58 | // Call the orderPizza method
59 | orderPizza("veg", "Margherita");
60 |
61 |
--------------------------------------------------------------------------------
/day-25/README.md:
--------------------------------------------------------------------------------
1 | # Day 25 - 40 Days of JavaScript - Async JavaScript - fetch() API
2 |
3 | ## **🎯 Goal of This Lesson**
4 |
5 | - ✅ Introduction
6 | - ✅ What Will We Learn Today?
7 | - ✅ What is fetch() API
8 | - ✅ fetch() API Syntax
9 | - ✅ fetch() with async/await
10 | - ✅ HTTP Methods
11 | - ✅ feth() - GET Resources
12 | - ✅ fetch() with Query Params
13 | - ✅ fetch() CREATE a Resource
14 | - ✅ fetch() UPDATE a Resource
15 | - ✅ fetch() DELETE a Resource
16 | - ✅ fetch() Custom Headers
17 | - ✅ Create REQUESTs
18 | - ✅ Handling Response &Error
19 | - ✅ Canceling fetch() Request
20 | - ✅ Tasks and Assignments
21 |
22 | ## How to run the API?
23 |
24 | - Open the terminal and change the directory to `api/blog`.
25 | - Then install the depenedencies with `npm install` command.
26 | - Run the API server locally with `npm run start` command.
27 |
28 | The API server will be available on `localhost:3000`.
29 |
30 | ## 🫶 Support
31 |
32 | Your support means a lot.
33 |
34 | - Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
35 | - Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
36 |
37 | > Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
38 |
39 | ### 🤝 Sponsor My Work
40 |
41 | I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
42 |
43 | ## Video
44 |
45 | Here is the video for you to go through and learn:
46 |
47 | [](https://www.youtube.com/watch?v=G3oPZSvrO9w "Video")
48 |
49 | ## **👩💻 🧑💻 Assignment Tasks**
50 |
51 | Please find the task assignments in the [Task File](./task.md).
52 |
--------------------------------------------------------------------------------
/live/live-one/index.js:
--------------------------------------------------------------------------------
1 | console.log("Live 01");
2 |
3 | /*
4 | - [ ] Create a `units` variable. Based on this value you will calculate the total electricity bill for a months.
5 | - [ ] If each day you consume the `units` and each unit cost 150 rupees, how much will you be charged per month?
6 | - [ ] If there is a 20% discount on the annual payment, how much will you be charged for an annual payment?
7 | */
8 |
9 | const unitsPerDay = 10;
10 | const costPerUnit = 150;
11 |
12 | const daysInMonth = 30;
13 |
14 | const monthlyBill = daysInMonth * costPerUnit * unitsPerDay;
15 |
16 | const annualBillWithoutDiscount = monthlyBill * 12;
17 |
18 | const discount = annualBillWithoutDiscount * 0.2;
19 |
20 | const annualBillWithDiscount = annualBillWithoutDiscount - discount;
21 |
22 | const a = 10;
23 | const b = 12;
24 | const c = 5;
25 |
26 | if (a === b && b === c) {
27 | return "Equilateral Triangle";
28 | } else if (a === b || b === c || a === c) {
29 | return "Isosceles Triangle";
30 | } else {
31 | return "Scalene Triangle";
32 | }
33 |
34 | let num = 6789;
35 | let reversed = 0;
36 |
37 | while (num > 0) {
38 | let eachDigit = num % 10; // 6
39 | reversed = reversed * 10 + eachDigit; // 9876
40 | num = Math.floor(num/10) // 0
41 | }
42 | reversed // 9876
43 |
44 |
45 | function createCounter() {
46 | let count = 0;
47 |
48 | return {
49 | increment: function() {
50 | count++;
51 | console.log(`Count: ${count}`);
52 | },
53 | decrement: function() {
54 | count--;
55 | console.log(`Count: ${count}`);
56 | },
57 | reset: function() {
58 | count = 0;
59 | console.log(`Count reset to: ${count}`);
60 | }
61 | };
62 | }
63 |
64 | // Usage
65 | const counter = createCounter();
66 | counter.increment(); // Count: 1
67 | counter.increment(); // Count: 2
68 | counter.decrement(); // Count: 1
69 | counter.reset(); // Count reset to: 0
70 |
71 |
--------------------------------------------------------------------------------
/day-17/task.md:
--------------------------------------------------------------------------------
1 | # Tasks
2 |
3 | Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
4 |
5 | > **DO NOT USE AI to FIND ANSWERS**. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
6 |
7 | ## 1. Find the Most Frequent Word in a Paragraph
8 |
9 | Consider the follwoing HTML:
10 |
11 | ```html
12 |
This is a test. This test is only a test.
13 | ```
14 |
15 | Now, find and display the most frequently occurring word. Also put a count of occurance beside it.
16 |
17 | Hints:
18 |
19 | - Use document.querySelector() or getElementById() to select the paragraph.
20 | - Convert the text into an array of words.
21 | - Use querySelector() to display the most frequent word along with the count inside another `
`.
22 |
23 | ## 2. Create a zebra pattern
24 |
25 | Consider the following HTML:
26 |
27 | ```html
28 |
29 |
BMW
30 |
Mahindra
31 |
Audi
32 |
Toyota
33 |
Honda
34 |
Hundai
35 |
Tata
36 |
Suzuki
37 |
38 | ```
39 |
40 | Now put alternate colors and background colors to each of the list tags. for example,
41 |
42 | - If tne BMW is in white color text, the background should be in black color.
43 | - Then for the next car it will be reversed, the color is black and the background is white.
44 | - Then again the next one is white color and background black
45 | - So on.
46 |
47 | ## 3. Write different ways we can access DOM and what they returns
48 |
49 | ## 4. Find and Replace Text Inside a Page
50 |
51 | Write a script that finds all occurrences of a word inside a `