Created
July 30, 2014 15:03
-
-
Save dougalcampbell/5052a28549b8ddd1c743 to your computer and use it in GitHub Desktop.
Multiline strings in JavaScript
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
/** | |
* See: https://github.com/isaacs/node-tap/blob/master/bin/tap.js#L65 | |
*/ | |
console.log({/* | |
This is a multiline string. | |
That is, a single string, spread out over many lines, | |
without the need to escape quotes or end-of-line | |
characters. | |
I'm not sure about browser compatibility, but it works | |
in nodejs and Chrome. | |
*/}.toString().split(/\n/).slice(1, -1).join("\n")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment