Recall & Review
beginner
What is the purpose of exporting values in JavaScript modules?
Exporting values allows you to share variables, functions, or objects from one file so other files can use them.
Click to reveal answer
beginner
How do you export a single value as the default export in JavaScript?
Use
export default followed by the value, for example: export default function() {}.Click to reveal answer
intermediate
What is the difference between named exports and default exports?
Named exports let you export multiple values by name, while default export lets you export one main value per module.Click to reveal answer
beginner
How do you export multiple values from a module?
You list them inside curly braces after the
export keyword, like export { a, b, c }.Click to reveal answer
beginner
Can you export a value immediately when declaring it? Give an example.
Yes, for example: <code>export const pi = 3.14;</code> exports the constant <code>pi</code> right away.Click to reveal answer
Which keyword is used to export a value from a JavaScript module?
✗ Incorrect
The
export keyword is used to share values from a module.How do you export a function as the default export?
✗ Incorrect
Use
export default function myFunc() {} to export a function as default.Which syntax exports multiple named values at once?
✗ Incorrect
Use
export { a, b } to export multiple named values.Can a module have more than one default export?
✗ Incorrect
A module can have only one default export.
What does this code do?
export const name = 'Alice';✗ Incorrect
It exports a constant named
name with the value 'Alice'.Explain how to export multiple values from a JavaScript module and how to import them.
Think about curly braces and matching names.
You got /3 concepts.
Describe the difference between default export and named export with examples.
One uses 'export default', the other uses 'export { }'.
You got /3 concepts.