Example 1 — Example
Core idea.
JavaScript
console.log("export function add(a,b){ return a+b }");
console.log("import { add } from './math.js'");How It Works
- export. Share bindings.
- import. Load them in another module.
ES modules use import/export, are always strict, and have their own top-level scope. Prefer modules over globals for maintainable apps.
console.log("export function add(a,b){ return a+b }");
console.log("import { add } from './math.js'");Core idea.
console.log("export function add(a,b){ return a+b }");
console.log("import { add } from './math.js'");CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful