Created
August 22, 2019 00:05
-
-
Save Jimmydalecleveland/06316aca2301f52ee6985773e4b0af6e 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
function taggedTemplate(stringArray, variable) { | |
console.log(stringArray) | |
// [ 'The string will be split here: ', ' Then it resumes here.' ] | |
console.log(variable) | |
// I am the great divider! | |
return `${stringArray[0]}${variable}${stringArray[1]}` | |
} | |
const stringVar = "I am the great divider!" | |
const customSentence = taggedTemplate`The string will be split here: ${stringVar} Then it resumes here.` | |
console.log(customSentence) | |
// The string will be split here: I am the great divider! Then it resumes here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment