Slide 7
Slide 7 text
㘗ך؝أزػؿؓ٦وٝأ
㸜Ⰻ䚍
㘗ךך
㷕统؝أز
涪؝أز
넝
搀
const items = {
apple: {
price: 128,
},
orange: {
price: 200,
taxRate: 0.1
}
}
const getPriceIncludingTax = (name, taxRate) => {
const item = items[name]
taxRate = taxRate || item.taxRate
if (taxRate == null) throw new Error("OMG")
return item.price * taxRate
}
㸜Ⰻ䚍搀
!