The “export default” keyword in JavaScript exports a single value from a module as the default export. For example, you can use “export default” to export a single value (function, class, or object) as the default export.
When you import in another module, you can import the default export without using “curly braces {}” and with any name you prefer.
Example
Create a sqcube.js file and add the following code.
export default function findCube(x) {
return x * x * x;
}
Now, create an app.js file and write the following code.
import square from './sqcube.js';
console.log(square(9));
Output
729
In sqcube.js, we define a function with the “export default” keyword to make it the default export. We can’t export defaults in more than one module in math.js. In the app.js file, we import the function with a different name (cube), proving that we can import default export functions with any name we want. And then, we print the result using the console.log() function.
The “export default” keyword is a robust way to export values from modules. In addition, it makes it easy to share code between modules and reuse code.

Niva Shah is a Software Engineer with over eight years of experience. She has developed a strong foundation in computer science principles and a passion for problem-solving.