Welcome to the Tips Calculator Challenge! In this challenge, you'll be working on creating a tips calculator using JavaScript. You'll create an array of test bill values, calculate tips and totals for each bill, and then calculate the average of all the totals.
-
Create Test Bills: Create an array called
bills
containing 10 test bill values. -
Create Empty Arrays: Create two empty arrays called
tips
andtotals
to store the calculated tips and totals respectively. -
Calculate Tips and Totals: Create a
calcTip
function to calculate the tips and total values (bill + tip) for every bill value in thebills
array using afor
loop to perform the calculations. -
Calculate Average: Create a
calcAverage
function which takes an array calledarr
as an argument. The function will calculate the average of all numbers in the parsed array. Then call this function with thetotals
array.
-
Clone the repository to your local machine: git clone https://github.com/Olamiposi-cloud-coder/forLoopChallenge.git
-
Open the index.js file and implement the calcTip and calcAverage functions based on the challenge details.
-
Run the code to see the calculated tips, totals, and the average total logged to the console.
Here's an example of how the output might look:
Copy code
- Tips: [5, 7, 3, ...]
- Totals: [25, 37, 19, ...]
- Average Total: 30.5
MDN Web Docs: Array MDN Web Docs: for loop
[Olamiposi-CLoud] - [https://github.com/Olamiposi-cloud-coder]
Feel free to contribute to the project by providing feedback, suggestions, or improvements via pull requests.
Happy coding!