Created
April 2, 2019 00:00
-
-
Save dangolbeeker/d743fea0a2c91af91e6f55bd9d2e53b5 to your computer and use it in GitHub Desktop.
JS Assignment 16: Using Callbacks in Array Methods created by dangolbeeker - https://repl.it/@dangolbeeker/JS-Assignment-16-Using-Callbacks-in-Array-Methods
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 exerciseOne(names){ | |
// Exercise One: In this exercise you will be given and array called names. | |
// Using the forEach method and a callback as it's only argument, console log | |
// each of the names. | |
names.forEach(function(name){ | |
console.log(name); | |
}); | |
} | |
function exerciseTwo(cents){ | |
// Exercise Two: In this exercise you will be given an array called 'cents' | |
// This array is a list of prices, but everything is in cents instead of dollars. | |
// Using the map method, divide every value by 100 and save it as a new array 'dollars' | |
const dollars = cents.map(function(price){ | |
return price/100; | |
}); | |
// Please write your answer in the lines above. | |
return dollars; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment