PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Written By
Views

Exporting functions in JavaScript

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'

That's It!


Thanks For Reading. More short knowledge coming 😁

Comments (0)

loading comments