javascript

How to find sum of a numeric property from array of object in JavaScript

const employees = [
    { name: "Raj", salary: 50000 },
    { name: "Amit", salary: 70000 },
    { name: "John", salary: 60000 }
];


let totalSalMonthly = employees.reduce((totalSal, emp)=>{
	totalSal = totalSal + emp.salary;
	return totalSal
},0);


console.log(totalSalMonthly);
// output : 180000