I am trying to solve two problem from the code below.
var employees = [
{
firstName: "John",
lastName :"Doe",
qualification: {Diploma: 'IT Software' , Degree: 'Software Engineering'}
},
{
firstName:"Anna",
lastName:"Smith",
qualification: {Diploma: 'Business Accountant' , Degree: 'Business Administration'}
}
];
for(var i in employees)
{
console.log(employees[i]);
}
The output from the code above is as follow.
[object Object] {
firstName: "John",
lastName: "Doe",
qualification: [object Object] {
Degree: "Software Engineering",
Diploma: "IT Software"
}
}
[object Object] {
firstName: "Anna",
lastName: "Smith",
qualification: [object Object] {
Degree: "Business Administration",
Diploma: "Business Accountant"
}
}
I am looking to index the output that is instead of [object object] it should display [index: 1] and [index : 2] for the respective object.
Your help would be appreciated. Thanks