From the course: JavaScript Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Challenge intro: Calculate sales tax

Challenge intro: Calculate sales tax - JavaScript Tutorial

From the course: JavaScript Essential Training

Challenge intro: Calculate sales tax

(upbeat music) - [Instructor] Computers are really good at doing mathematical calculations. That's why they're called computers. And working with JavaScript, you'll often use math formulas to accomplish tasks. In this challenge, you'll get to try this for yourself by creating a basic sales tax calculator for a store. In the test code setup, you'll find an almost completed setup to calculate taxes and totals for a store in British Columbia, Canada. There are two taxes here, the GST, which is 5%, and the PST, which is 8%, and both of these taxes need to be applied independently to the before tax total to get the final price. Your task is to complete the calculateTotal function by adding GST, PST, and sum properties to the totals objects and performing the necessary math to get the right numbers in each property. You can see at the bottom here that all this information gets output at the end and you want this output to…

Contents