Learn everything about export default

Last Updated: March 15, 2020

Why do you need export

You can use export statement to export function, objects or primitive values to other JavaScript code.

By looking at the following example you can learn how you can export a function to another js code

@your util.js file

function calculatesalary(){
        return "Salary is 10000";
}
export default calculatesalary;

@your index.js

import calc from './Util.js'

console.log(calc)