Exporting functions in JavaScript

This latest post after so many days. Just working on a project so writing less but yea from now on will be regular. Exporting functions in JavaScript is a fundamental thing you should know for any type of projects it's just important.

Functions in JavaScript is defined as a set of statements that performs a task or **calculates a value**, but for a procedure to qualify as a function, it should take some **input and return an output** where there is some obvious relationship between the input and the output.

Generally, we code to function as

function sum(f, b) {
  return f + b

You make available for other files to use this function as by this command

export default sum

We called this as default export

The files that need the function exported will bring in it using this following syntax:

import sum from 'filename'

Thanks For Reading. More short knowledge coming 😁

© 2020 RAHULISM • Developed with ❤️ and 🍕 by RAHUL