A developer has a module that contains multiple functions.
What kind of export should be leveraged so that multiple functions can be used?
Correct Answer: D
The correct answer is D.
When a module contains multiple functions and each function should be available individually, the best choice is a named export.
Example:
function add(a, b) {
return a + b;
}
function subtract(a, b) {
return a - b;
}
export { add, subtract };
Then another file can import exactly the functions it needs:
import { add, subtract } from './mathUtils.js';
console.log(add(5, 2));
console.log(subtract(5, 2));
Named exports are useful when a module provides several reusable functions, constants, or classes.
Why the other options are incorrect:
multi is not a JavaScript export type.
default is usually used when a module has one main value to export. A module can only have one default export.
all is not an export type in JavaScript module syntax.
Therefore, the correct export type for multiple functions is named export, so the verified answer is D.