Is it possible for me to create an Index into an Object? Here is my object:
var objName = {};
var array1 = ['apple','sugar'];
var array2 = ['spoon','fork'];
var array3 = ['spoon2','fork2'];
var array4 = ['spoon3','fork3'];
objName['main'] = array1;
objName['submain'] = array2;
objName['main'] = array3;
objName['submain'] = array4;
console.log(objName);
question is, I want to add another value to the object without my previous object being erased. Assuming that the objName is a global object variable and I'm going to use it again and again and pushing different values into it. I am expecting an output where in I can see also my previous records.