dabidabidesh

Orders

Jun 15th, 2020
331
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //14 FUNCTIONS/04. Orders.js
  2. function orders(product, quantity) {
  3.   'use strict'
  4.  
  5.   const solve = (product, quantity) => {
  6.  
  7.     let price = 0
  8.  
  9.     switch (product) {
  10.       case 'coffee':
  11.         price = 1.50
  12.         break
  13.       case 'water':
  14.         price = 1.00
  15.         break
  16.       case 'coke':
  17.         price = 1.40
  18.         break
  19.       case 'snacks':
  20.         price = 2.00
  21.     }
  22.     return (price * quantity).toFixed(2)
  23.   }
  24.  
  25.   console.log(solve(product, quantity))
  26. }
RAW Paste Data