Есть массив объектов:
let data = [
{
"ID": 671055,
"JobTitle": "Project Manager",
"City": "New York",
},
{
"ID": 683759,
"JobTitle": "Project Manager - Philadelphia",
"City": "Philadelphia",
},
{
"ID": 710323,
"JobTitle": "Assistant Project Accountant",
"City": "Philadelphia",
},
{
"ID": 700730,
"JobTitle": "Marketing Coordinator",
"City": "New York",
},
{
"ID": 698950,
"JobTitle": "Project Accountant",
"City": "New York",
}
];
как получить новый отфильтрованный массив объектов:
let dataNew = {
'New York': [
{
"ID": 671055,
"JobTitle": "Project Manager",
"City": "New York",
},
{
"ID": 700730,
"JobTitle": "Marketing Coordinator",
"City": "New York",
},
{
"ID": 698950,
"JobTitle": "Project Accountant",
"City": "New York",
}
],
'Philadelphia': [
{
"ID": 683759,
"JobTitle": "Project Manager - Philadelphia",
"City": "Philadelphia",
},
{
"ID": 710323,
"JobTitle": "Assistant Project Accountant",
"City": "Philadelphia",
}
]
};