Skip to content

Instantly share code, notes, and snippets.

@eduzol
Created September 7, 2017 09:04
Show Gist options
  • Save eduzol/44635797f9c5705c41c3dfbb1e9e122b to your computer and use it in GitHub Desktop.
Save eduzol/44635797f9c5705c41c3dfbb1e9e122b to your computer and use it in GitHub Desktop.
/* Write a Curried Function
*
* Create a function called "houseBuilder" that should:
* - Accept the number of stories (floors)
* - Return a function
*
* The returned function should:
* - Accept the color of the house
* - Return a string in the following format:
* "building a <numOfStories>-story, <color> house"
*
* Example:
* const response = houseBuilder(3)('blue');
* console.log(response); // building a 3-story, blue house
*/
var houseBuilder = function ( stories) {
return function(color ){
return 'building a ' + stories+'-story, '+color+' house';
};
};
const response = houseBuilder(3)('blue');
console.log(response); // building a 3-story, blue house
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment