I have a form which the user is able to change the id of, so I have declared an array containing the details of the form and the array is updated in case the details of the form change, so I can have something like

Code JavaScript:
formdetails = ['someid', 'index.html', 'post'];

but the user can change any of those and the form details could be updated to:

Code JavaScript:
formdetails = ['someotherid', 'form.php', 'get'];

then from inside the function I can call the form by doing:

Code JavaScript:
document.getElementById(formdetails[0]);

I am still learning JS and have read a lot that is best to avoid, as much as possible, the usage of global variables and would like to know how I could use that same updated array or any other variable inside a function if is not global