I am creating an object off of a bunch of variables, and in one place the variable doesn't seem to pass through (it uses the literal variable name). Let me show what I mean
newObj = function (name, test, answers){
var myObj = {"name" : name , "test" : [{test : answers}] };
}
So, the name and the answers come in fine (answers is an array). But the string for the key test does not pass in. it is coming in correctly (I can console.log it above), however the object is creating the key as the literal variable name so if I did something like :
newObj("Bob","cat","red");
IT would give me back an object looking like :
myObj = {"name" : bob , "test" : [{test : "red"}];
So as you can see they key for the object in "test" is not passing in it's variable. Any way to solve this? Thanks!