const prices = [2.80, 6.10, 1.50, 1.00, 8.99, 2.99] function totalCost(prices){ return prices.reduce((sum, item) => sum + item, 0) } function product(array){ return array.reduce((total, num) => total*num, 1) } const pricePerKg = 1.50 const numberOfKg = 10 const conversionRate = 1.16 const conversion = [1.50, 10, 1.16] const USprice = product([pricePerKg,numberOfKg,conversionRate])
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter