dabidabidesh

Orders 2

Jun 15th, 2020
326
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.     let price = 0
  7.  
  8.     switch (product) {
  9.       case 'coffee':
  10.         price = 1.50
  11.         break
  12.       case 'water':
  13.         price = 1.00
  14.         break
  15.       case 'coke':
  16.         price = 1.40
  17.         break
  18.       case 'snacks':
  19.         price = 2.00
  20.     }
  21.     return price
  22.   }
  23.  
  24.   console.log((getPrice(product) * quantity).toFixed(2))
  25. }
RAW Paste Data