how to avoid global variables?
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
formdetails = ['someid', 'index.html', 'post'];
but the user can change any of those and the form details could be updated to:
formdetails = ['someotherid', 'form.php', 'get'];
then from inside the function I can call the form by doing:
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