Learn everything about export default

October 20, 2019

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)