Skip to content

Instantly share code, notes, and snippets.

@ilearnjavascript
Created March 27, 2019 23:45
Show Gist options
  • Save ilearnjavascript/9f3b7b1aa6e4badcc5694477be939584 to your computer and use it in GitHub Desktop.
Save ilearnjavascript/9f3b7b1aa6e4badcc5694477be939584 to your computer and use it in GitHub Desktop.
es6 - modules - 5.js
// default import
import defaultModule from './modules.js';
// named import
import { module1, module2, module3 } from './modules.js';
document.body.insertAdjacentHTML('beforeend', '<div>' + defaultModule + '</div>');
document.body.insertAdjacentHTML('beforeend', '<div>' + module1 + '</div>');
document.body.insertAdjacentHTML('beforeend', '<div>' + module2 + '</div>');
document.body.insertAdjacentHTML('beforeend', '<div>' + module3 + '</div>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment