Currently, I am facing a somewhat awkward predicament where I have a function in main.js that requires an array that is populated in second.js...
In simple terms, the function in main.js is designed to be reusable:
function chug()
{
p1.innerHTML = st_a[0];
p2.innerHTML = st_a[1];
...
}
The variable 'st_a' is meant to be interpreted as: st_ + , with 'a' being the specific variable in this scenario. The concept is that the second.js file will contain multiple arrays (st_a, st_b, etc.) and depending on the requirement, the corresponding array will be used to fill the paragraph elements (p1, p2, etc.)
Any suggestions on how to tackle this situation?