how to push object in array using for loop javascript

JavaScript
var title = [];
for (var i=0; i<3; i++) {
    title[i] = {
        name: "name" + i+1,
        age: "age" + i+1,
        hometown: "hometown" + i+1
    };
}
console.log(title);
// output will be:
// [ { name: 'name1', age: 'age1', hometown: 'hometown1' },
//   { name: 'name2', age: 'age2', hometown: 'hometown2' },
//   { name: 'name3', age: 'age3', hometown: 'hometown3' } ]

Source

Also in JavaScript: