ES2024 Features

Object.groupBy()

				
					const empList = [
    {name:"Ashok",age:12},
    {name:"Abhishek",age:32},
    {name:"Ramesh",age:42},
    {name:"Shrikant",age:28},
];
function myCallback({ age }) {
  return quantity > 30 ? "senior" : "junior";
}

console.log(Object.groupBy(empList,
    emp => emp.age > 30 ? "Senior": "Junior"));
				
			

Map.groupBy()

Leave a Comment