I'm facing a challenge with the code snippet provided 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 current output of the above code is as follows:
[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"
}
}
My goal is to customize the output so that instead of displaying [object object], it shows [index: 1] and [index : 2] for the respective objects.
Your assistance in solving this issue would be greatly appreciated. Thank you!