console.table() can be used to display objects and arrays in a tabular format.
var personArr = [
{ "personId": 101,
"name": "Sandeep",
"city": "Titerwara",
"phoneNo": "1234567890"
},
{ "personId": 102,
"name": "Shiv",
"city": "Buchcha Kheri",
"phoneNo": "1234567890"
},
{ "personId": 103,
"name": "Kandela",
"city": "Perth",
"phoneNo": "1234567890"
},
{ "personId": 104,
"name": "Amit",
"city": "Buchcha Kheri",
"phoneNo": "1234567890"
}
];
console.table(personArr, ['name', 'personId']);
Output Will be like This-
var personArr = [
{ "personId": 101,
"name": "Sandeep",
"city": "Titerwara",
"phoneNo": "1234567890"
},
{ "personId": 102,
"name": "Shiv",
"city": "Buchcha Kheri",
"phoneNo": "1234567890"
},
{ "personId": 103,
"name": "Kandela",
"city": "Perth",
"phoneNo": "1234567890"
},
{ "personId": 104,
"name": "Amit",
"city": "Buchcha Kheri",
"phoneNo": "1234567890"
}
];
console.table(personArr, ['name', 'personId']);
Output Will be like This-
No comments:
Post a Comment