I am trying to sort object of arrays by arrays length, for example, i try to get from this object array where length more than 3
{
friend: [
{ id: 0, name: 'A' },
{ id: 1, name: 'V' },
{ id: 2, name: 'C' },
{ id: 3, name: 'D' }
],
people: [ { id: 0, name: 'A' }, { id: 1, name: 'B' } ]
}
and the result will array friend. I try to do this
function getPart (obj) {
for (let key in obj) {
if (obj[key].length>=4) {
console.log(obj[key]);
}
}}
but I want to try to do it with filter object but I have no idea how to make it
friendobject?