var persons = new Array();
var person = {
firstname: "Padma",
Id: 1,
Country: "India"
};
persons.push(person);
persons.push([person = {
firstname: "Balaji",
Id: 3,
Country: "India"
}]);
persons.push([person = {
firstname: "Sivasree",
Id: 2,
Country: "India"
}]);
document.getElementById("demo").innerHTML = persons.length;
$.each(persons, function(key, value) {
console.log(value.firstname + " " + value.Country + "\n");
});
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<h2>JavaScript Objects</h2>
<p>JavaScript uses names to access object properties.</p>
<p id="demo">
</body>
</html>