-
Write a function called
average
that takes an array of numbers as a parameter and returns the average of those numbers.After you write your function, you can test it using the above inputs to make sure that it behaves correctly.
-
Write a function called
min
that finds the smallest number in an array of numbers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function square(x) { | |
return x*x; | |
} |
function each(coll, func) {
Try to write all of the exercises using both the for
loop and while
loop.