-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheight.js
More file actions
33 lines (27 loc) · 750 Bytes
/
Copy patheight.js
File metadata and controls
33 lines (27 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const myNums = [1, 2, 3]
// const myTotal = myNums.reduce( (acc, currval) => {
// console.log(`acc: ${acc} and currval: ${currval}`);
// return acc + currval
// }, 0)
const myTotal = myNums.reduce( (acc, currval) => acc+currval, 0);
// console.log(myTotal);
const shoppingCart = [
{
itemName: "js course",
price: 2999
},
{
itemName: "react course",
price: 1999
},
{
itemName: "backend course",
price: 3999
},
{
itemName: "fullstack course",
price: 5999
}
]
const priceToPay = shoppingCart.reduce( (acc, item) => acc + item.price,0)
console.log(`Thanks for subscribe our course and your total payment is: ${priceToPay}`);