Created
May 18, 2019 10:07
-
-
Save Falci/629fc3c7fef1fcac87e8e9ed6df12d2b to your computer and use it in GitHub Desktop.
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
const highlight = ([...strings], ...values) => strings.reduce( | |
(sentence, string) => `${sentence}<strong>${values.shift()}</strong>${string}`, | |
strings.shift() | |
); | |
const name = 'F_NAME'; | |
const what = 'project'; | |
const sentence = highlight`Good luck ${name} in your new ${what}`; | |
console.log(sentence); // Good luck <strong>F_NAME</strong> in your new <strong>project</strong> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment