Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

import everything javascript

// The file you wish to export: (add.js)
export { add };
const add = (n1, n2) => n1 + n2;

// The file where you want to import it: (script.js)
import * as Addition from "./add.js";
const test1 = Addition.add(10, 20) // Results to 30
const test2 = Addition.add(100, 1) // Results to 101
 
PREVIOUS NEXT
Tagged: #import #javascript
ADD COMMENT
Topic
Name
7+1 =