Recall & Review
beginner
What is a module in JavaScript?
A module is a file that contains JavaScript code which can be imported and used in other files. It helps organize code into smaller, reusable pieces.
Click to reveal answer
beginner
Why do we use modules in JavaScript?
Modules help keep code organized, avoid name conflicts, and make it easier to reuse and maintain code by splitting it into smaller parts.
Click to reveal answer
intermediate
How do modules help avoid name conflicts?
Each module has its own scope, so variables and functions inside one module don’t clash with those in another module.
Click to reveal answer
beginner
What is one real-life example of using modules?
Like organizing tools in separate boxes, modules keep related code together so you can find and use it easily without mixing everything up.
Click to reveal answer
intermediate
Name two ways to export code from a JavaScript module.
You can use named exports (exporting multiple things by name) or default export (exporting one main thing).
Click to reveal answer
What is the main purpose of using modules in JavaScript?
✗ Incorrect
Modules help organize code into smaller, reusable pieces, making it easier to manage.
How do modules help prevent name conflicts?
✗ Incorrect
Each module has its own scope, so variables inside one module don’t clash with others.
Which of these is NOT a benefit of using modules?
✗ Incorrect
Modules do not translate code; they help organize and reuse code.
What is a default export in a JavaScript module?
✗ Incorrect
Default export lets you export one main value or function from a module.
Which statement is true about modules?
✗ Incorrect
Modules split code into smaller, manageable files.
Explain why using modules is helpful when writing JavaScript code.
Think about how breaking big tasks into smaller parts helps.
You got /4 concepts.
Describe how modules prevent variables from clashing with each other.
Imagine each module as its own little box.
You got /3 concepts.