Skip to content

Instantly share code, notes, and snippets.

@haingdc
Created March 13, 2018 04:59
Show Gist options
  • Save haingdc/011892aef1b67a9afa59bf5ad6ca2b41 to your computer and use it in GitHub Desktop.
Save haingdc/011892aef1b67a9afa59bf5ad6ca2b41 to your computer and use it in GitHub Desktop.
A Gentle Introduction to Functional JavaScript: Part 3
var twinkle = function(noun, wonderAbout) {
return 'Twinkle, twinkle, little ' +
noun + '\nHow I wonder where you ' +
wonderAbout;
}
// fix-cứng noun
var twinkleBat = partial(twinkle, 'bat');
twinkleBat('are at'); // Twinkle, twinkle, little bat\nHow I wonder where you are at
// fix-cứng noun và wonderAbout - áp dụng toàn phần/hard-coded!
var twinkleStar = partial(twinkle, 'star', 'are');
twinkleStar(); // Twinkle, twinkle, little star\nHow I wonder where you are
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment