Can you help me figure out what's causing an issue when attempting to add a new element to an associative array of objects?
var storeData3 = [
{ 'key1' : 'value1' },
{ 'key2' : 'value2' },
{ 'key3' : 'value3' },
{ 'key6' : null},
{ 'key7' : ''},
{ 'key8' : ""},
{ 'key9' : null},
{ 'key10' : 'value4'}
]; //as JSON object
var i=0;
storeData3=JSON.stringify(storeData3, function(key, value)
{if(!value)
{
i++;
};
return value;
});
JSON.parse(storeData3);
function insert(name, number)
{
storeData3.push({name: number});
}
if(i>0) insert('keyX','null');
The error message reads "TypeError: storeData3.push is not a function".