Last active
November 5, 2015 01:55
-
-
Save KimSarabia/42fc5ac73bd59c1bc553 to your computer and use it in GitHub Desktop.
Eloquent Javascript Ch. 2 Functions Exercises
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
//Don't understand functions very well. Decided to write | |
//it in a way that I would understand as a former finance associate. | |
function insurancecost(fee) { | |
return function(staffsize) { | |
return staffsize * fee; | |
}; | |
} | |
var portlandoffice = insurancecost(30000); | |
console.log(portlandoffice(97)) | |
// → 2910000 | |
function tvownershipincity(population) { | |
return function(avgtvownership) { | |
return avgtvownership * population; | |
}; | |
} | |
var miami = tvownershipincity(1.7); | |
console.log(miami(417650)); | |
// → 710005 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment