if(true) { (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); } if (typeof ga === "function") { ga('create', 'G-EZ0B2QJ2Z6', 'auto', {}); }Exporting functions in JavaScript | RAHULISM

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