So, I have following js to check if object exists in the NAMES variable. If it does not, I want to push the whole object array into the variable as below:
var NAMES = {};
function NAME_INFO(name,input1,input2,input3){
return name : [input1, input2, input3], ;
}
...
NAMES.push(NAME_INFO(my_name,first,middle,last)); //some variables that I have.
The ending result that I am trying to get is as follow:
var NAMES = {
'185' : ['ryan', 'some', 'last'],
'15' : ['mike', 'middle', 'Mcdonald'],
'122' : ['emily','else', 'Another']
};
I am not sure if this is the right setup for it. I am not sure how to make the function correctly.
Could someone point me to the right direction? Thanks.
ifsection as it works fine. I am just having a hard time adding this mixed array into theNAMESvariable.return name : [input1, input2, input3], ;" mean?