Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get an array from another script in js

// SCRIPT WHERE THE ARRAY IS
var yourArray;
export{yourArray/*, OtherThingsYouWannaExport*/}

// SCRIPT WHERE WE NEED THE ARRAY
import * as chooseName from './TheNameOfYourScriptFile.js'
chooseName.yourArray; // You can now access the array
 
PREVIOUS NEXT
Tagged: #array #script #js
ADD COMMENT
Topic
Name
6+4 =