Skip to content

Instantly share code, notes, and snippets.

@paigen11
Last active September 15, 2019 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paigen11/0657216f3d96cc2f9318b642ad4100b7 to your computer and use it in GitHub Desktop.
Save paigen11/0657216f3d96cc2f9318b642ad4100b7 to your computer and use it in GitHub Desktop.
Example of the .raw argument in a string
function tag(strings) {
console.log(strings.raw[0]);
}
tag`I'd like this line 1 \n to ignore the newline and be in line with 1
\n even though I should be on line 3 at this point`;
/* prints: I'd like this line 1 \n to ignore the newline and be in line with 1
\n even though I should be on line 3 at this point */
// including the two characters '\' and 'n' multiple times
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment