I'm attempting to write a function to take a string as an input (some of the strings that come in will actually be the names of arrays), and will create an entry in an HTML menu with that string. The main trouble is that I have an array associated with each string, but the name of the array is the string + "txt". What I've done so far involves calling a first function, which takes arguments of the string, and the level into the array that it has read (since these are nested arrays), and the goal is to pass to another function, the string, and the string with the appended "txt", but I run into problems when I assign something a value of that "string + 'txt'" when the string is the name of an array because javascript will just add "txt" to the array as an element.
I've tried this:
function splitName(name, level) { var arg1 = name; var arg2 = name + "txt"; generateMenu(name, arg1, arg2, level); }
In short, I'm wondering if there is a way that I can pull out the name of the array as a string and manipulate that?
Please comment with any questions or if anything is unclear. I'm a little new to programming.