I have a Javascript object that I am trying to make. This object is meant to have named values based on an array of strings.
So I want to convert an array like this:
var arr = ["name1", "name2", "name3"]
Into an object like this:
var obj = {
name1: "",
name2: "",
name3: ""
}
It seems obvious to me that I can't simply pull the name of the previous variables to get the name of the parameter since the name appears to be hard coded. Anything similar to my question answers how to fill in the value, not the name. I assume if worse comes to worse, I could use the "eval" function, but that seems to add a lot of complexity to something that seems relatively straightforward.