Horje
javascript map with arrow function Code Example
javascript map with arrow function
const products = [
    { name: 'Laptop', price: 32000, brand: 'Lenovo', color: 'Silver' },
    { name: 'Phone', price: 700, brand: 'Iphone', color: 'Golden' },
    { name: 'Watch', price: 3000, brand: 'Casio', color: 'Yellow' },
    { name: 'Aunglass', price: 300, brand: 'Ribon', color: 'Blue' },
    { name: 'Camera', price: 9000, brand: 'Lenovo', color: 'Gray' },
];
//Total products price by using Map
let total = 0;
const getPrice = products.map(product => {
    total = total + product.price;
});
console.log(total)
//Expected outPut: 45000




Javascript

Related
javascript increment alphabet Code Example javascript increment alphabet Code Example
appregistry react native Code Example appregistry react native Code Example
angular subscribe on value change Code Example angular subscribe on value change Code Example
install mysql rails Code Example install mysql rails Code Example
mysql install Code Example mysql install Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8