Skip to content

Instantly share code, notes, and snippets.

@KimSarabia
Last active November 5, 2015 01:55
Show Gist options
  • Save KimSarabia/42fc5ac73bd59c1bc553 to your computer and use it in GitHub Desktop.
Save KimSarabia/42fc5ac73bd59c1bc553 to your computer and use it in GitHub Desktop.
Eloquent Javascript Ch. 2 Functions Exercises
//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