Last active
February 8, 2018 08:18
-
-
Save bharathvaj-ganesan/a04a3ac7c12f6bafe281a06c80078959 to your computer and use it in GitHub Desktop.
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
| function highlight(strings, ...values) { | |
| // here i is the iterator for the strings array | |
| return strings.reduce((result, string, i) => { | |
| return `${result}${string} <cite>${values[i] || ''}</cite>`; | |
| }, ''); | |
| } | |
| const author = 'Thomas A. Edison'; | |
| const statement = `I have not failed. I've just found 10,000 ways that won't work.`; | |
| const quote = highlight`${statement} by ${author}`; | |
| console.log(quote) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment