Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Multiline strings in JavaScript

View multilinestrings.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/**
* 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
Something went wrong with that request. Please try again.