Exercise 3: How much is the Bill?
In this exercise, you will be required to add the function totalBill as a property to an object and implement it.
We'll cover the following
Problem Statement
In this exercise, you are required to write a function totalBill
that returns the total bill after the customer buys that product.
Note: Assume all prices are in dollars.
The object is already given below. However, the property values are not set. You can set them to whatever you want. The skeleton of the function is already given; you just need to write its implementation.
Sample Input
-
name
: Cheese -
price
: 20 -
amount
: 10 -
madeIn
: USA
Sample Output
totalBill
returns 200 dollars.
Note: The solution to this exercise is available in the code widget below. However, it’ll be good practice to solve this problem yourself first. Good luck!
Get hands-on with 1400+ tech skills courses.