1. Home
  2. Javascript
  3. Es6 modules
#javascript#es6#modules

This ES6 feature allows you to easily import and export whole modules or parts of them between javascript files.

// file-one.js
    export function sendInfo(){
        // ...
    }

// file-two.js
    // import whole module
    import Comms from 'CommunicationModule'

    // or import individual methods using destructuring
    import { sendInfo } from './js/file-one.js'
copy
Full Javascript cheatsheet
Sitemap Git repository