Answers for "import everything javascript"

0

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
Posted by: Guest on July-26-2021

Code answers related to "import everything javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language