Last active
October 30, 2015 15:49
-
-
Save petermoresi/79e4c72c107d935a4ec9 to your computer and use it in GitHub Desktop.
String.raw and ES6 template strings
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
let a = 1, b = 2, foo="foo", bar="bar", credentials: "insecure"; | |
String.raw`http://foo.org/bar?a=${a}&b=${b} | |
Content-Type: application/json | |
X-Credentials: ${credentials} | |
{ "foo": ${foo}, | |
"bar": ${bar}}`; | |
/* The code above produces the result | |
"http://foo.org/bar?a=1&b=2 | |
Content-Type: application/json | |
X-Credentials: undefined | |
{ "foo": foo, | |
"bar": bar}" | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment