Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.         function estimatePrice(cost, action) {
  3.             let profit = 50
  4.             let subtotal = cost + profit
  5.             action(subtotal)
  6.         }
  7.         function applyNormalVAT(subtotal) {
  8.             console.log(subtotal * 1.21)
  9.         }
  10.         function applyReducedVAT(subtotal) {
  11.             console.log(subtotal * 1.1)
  12.         }
  13.         function noVATApplied(subtotal) {
  14.             console.log(subtotal)
  15.         }
  16.         estimatePrice(100, applyNormalVAT)
  17.         estimatePrice(245, applyReducedVAT)
  18.         estimatePrice(87, applyReducedVAT)
  19.         estimatePrice(6, noVATApplied)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement