About Lesson
Combining Named and Default Exports:
You can mix default and named exports in a module.
Example:
File: utils.js
JavaScript
export const greet = (name) => `Hello, ${name}!`;
export default function farewell(name) {
return `Goodbye, ${name}!`;
}
File: main.js
JavaScript
import farewell, { greet } from './utils.js';
console.log(greet('Manjeet')); // Output: Hello, Manjeet!
console.log(farewell('Manjeet')); // Output: Goodbye, Manjeet!