Skip to content

Day 32 #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ I am an independent educator and open-source enthusiast who creates meaningful p
- **`Day 29: Object Oriented Programming (OOP) Explained with Real-Life Analogies`** - [Watch Video](https://www.youtube.com/watch?v=oRQOiyO-kHg) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-29/README.md)
- **`Day 30: From Zero to OOP Hero with JavaScript ES6 Classes`** - [Watch Video](https://youtu.be/kG5t34ciG9w) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-30/README.md)
- **`Day 31: Master JavaScript Prototypes and Object Patterns - Confused to Confident!`** - [Watch Video](https://youtu.be/Uru85QW9zkk) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-31/README.md)
- **`Day 32: Master JavaScript Modules: import, export, and Organize Like a Pro!`** - [Watch Video](https://youtu.be/l50gnBWHmdA) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-32/README.md)
37 changes: 37 additions & 0 deletions day-32/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Day 32 - 40 Days of JavaScript - Modules

## **🎯 Goal of This Lesson**

- ✅ What are Modules in JavaScript, and Why to Use?
- ✅ What are Exports and Imports in JavaScript Module?
- ✅ What are Exports and Imports in JavaScript Module?
- ✅ What are Default and Named Module Exports in JavaScript?
- ✅ What are Aliases in JavaScript Module Import?
- ✅ What are Namespaces in JavaScript Module?
- ✅ What is Combined Export in JavaScript Module?
- ✅ What is Dynamic Import in JavaScript Module?
- ✅ How to Handle Multiple Imports Using JavaScript Promise APIs?
- ✅ What is Tree Shaking & How Does It Help?

## 🫶 Support

Your support means a lot.

- Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
- 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.

> Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)

### 🤝 Sponsor My Work

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)**.

## Video

Here is the video for you to go through and learn:

[![day-32](./banner.png)](https://youtu.be/l50gnBWHmdA "Video")

## **👩‍💻 🧑‍💻 Assignment Tasks**

Please find the task assignments in the [Task File](./task.md).
Binary file added day-32/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions day-32/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Tasks

Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".

> **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.

## 1. Split a Utility Library

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.

## 2. Create a Feature-Based Module Structure

Create a small blog app where:

- post.js handles posts
- user.js handles user info
- main.js brings it together via import

## 3. Use Named vs Default Exports

Create modules with both named and default exports, and demonstrate:

- How to import them correctly
- How to rename named exports during import

## 4. Mock an API Module

Create api.js that exports functions like fetchUsers, createUser, etc.

- Simulate network delays using setTimeout
- Use these in a frontend to display mock data

## 5. Quiz App Modularized

Modularize a quiz app:

- questions.js: array of questions
- quizLogic.js: handles quiz flow
- ui.js: handles DOM updates
- main.js: runs everything