Created
May 29, 2017 00:26
-
-
Save jboxman/f7b57d4c8343820c7208f2ac930ccd21 to your computer and use it in GitHub Desktop.
Kyle Simpson's example for tagged template literals in ES6
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
// https://github.com/getify/You-Dont-Know-JS/blob/master/es6%20%26%20beyond/ch2.md#tagged-template-literals | |
function foo(strings, ...values) { | |
console.log( strings ); | |
console.log( values ); | |
} | |
var desc = "awesome"; | |
foo`Everything is ${desc}!`; | |
// [ "Everything is ", "!"] | |
// [ "awesome" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment