Last active
July 2, 2022 15:29
-
-
Save adambene/80694b5e7299b2f3a8d7e665b05c8a49 to your computer and use it in GitHub Desktop.
Currying in JavaScript ES6 - render HTML
This file contains 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
renderHtmlTag = tagName => content => `<${tagName}>${content}</${tagName}>` | |
renderDiv = renderHtmlTag('div') | |
renderH1 = renderHtmlTag('h1') | |
console.log( | |
renderDiv('this is a really cool div'), | |
renderH1('and this is an even cooler h1') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment