Push associative array into array in JavaScript
let myArray = [];
function insert(key, value) {
let obj = {};
obj[key] = value;
myArray.push(obj);
}
insert("name", "John");
insert("age", 30);
insert("city", "New York");
console.log(myArray);
In this example, we declare an empty array cal...
blog.qodesign.net3 min read