Question:
I am having difficulties with returning a pre-declared array from user feedback. This is an exercise meant to help me understand how to take user input using a drop-down in HTML and return a value based on a script.What I want the second part of the script to do is return the array whose name is the string selected by the user.
Would appreciate any feedback telling me what to look into or suggestions for solutions.
Thanks a lot!
Answer:
If I’m not mistaken you could usevar
instead of const
this way variables would not be scoped and attached to the global object window
and so be accessible using window[name]
.try
If you have better answer, please add a comment about this, thank you!