o

Javascript Assignment 4

Read chapter 5 (Functions) 

1. Create a function that takes a comma-separated string of numbers, and returns the average number.

2. Create a simple calorie burn calculator function for runners.  It should take inputs of a person's weight, and number of miles run. 

Here's the logic: 

First, multiply your weight (in pounds) x 0.75.  Next multiply this total times the number of miles ran, and this equals (roughly) the calories burned. For example, a jogger who weighs 150 pounds and runs four miles would burn roughly 450 calories. We get this number by taking 150 x 0.75, which equals 112.5, then multiplying by four, since the jogger ran four miles.
(the formula comes from here)

3. Create a function that will take a string of numbers like: 9999999999 or 333-333-3333 and convert it into a phone number format like: (999)999-9999.

4.  What is an anonymous function?  Explain & give example: Rewrite one of your functions above as an anonymous function.

5.  Here's the fun one: Modify our text slideshow code from class to create an image slideshow, with forward & back button controls.  It doesn't need to have any fancy transitions, just a basic image change.