📘named export
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
JS ⟩ module ⟩ ES ⟩ export ⟩ named export
// export variables declared elsewhere
export { f1, f2 };
// export declarations
export let a = Math.sqrt(2);
export function f() { ... };
replit:named exports
// math.js
// ⭐️ named exports
export function add(a, b) { return a + b }
export function subtract(a, b) { return a - b }
export function multiply
📁 index.js
// ⭐️ import "named exports"
import { add, subtract, multiply, divide } from './math.js';
[
add(1, 2), // 3
subtract(1,