## JS Syntax to Import ##
# WebDock.html..
- At the bottom of your html file script tag, you MUST add the (type="module"). So the browser allows the modules function to work.
# main.js
- Add the "Import" statement at the TOP of your main.js
# Option 1
- import { myBoxers, one } from "./myFunc.js"
# Option 2: Change the name of the func
- import { myBoxers as boxerList_Array, one } from "./myFunc.js"
-----------------------------------------------------------
# The external file - Method 1..
- Add the "Export" statement onto each individual function you want to export
# File name = myFunc.js
export function one() {
const testOne = "this is a test"
}
export var myBoxers = [
["Heavyweight", "Select A Boxer.."],
["Heavyweight", "Anthony Joshua"],
["Heavyweight", "Tyson Fury"],
["Heavyweight", "Diilian Wyhte"]
];
----------------------------------------------------------
# The external file - Method
- Add the "Export" statement to the END of all functions
# File name = myFunc.js
function one() {
const testOne = "this is a test"
}
var myBoxers = [
["Heavyweight", "Select A Boxer.."],
["Heavyweight", "Anthony Joshua"],
["Heavyweight", "Tyson Fury"],
["Heavyweight", "Diilian Wyhte"]
];
export { myBoxers, one }
---------------------------------------------------------