dabidabidesh

order object

Jun 15th, 2020
318
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. orders = (product, quantity) => {
  2.   'use strict'
  3.  
  4.   const getPrice = (product) => {
  5.  
  6.     const price = {
  7.         coffee: 1.50,
  8.         water: 1.00,
  9.         coke: 1.40,
  10.         snacks: 2.00
  11.     }
  12.     return price[product]
  13.   }
  14.  
  15.   console.log((getPrice(product) * quantity).toFixed(2))
  16. }
RAW Paste Data