Created
June 16, 2014 14:07
-
-
Save chp-io/210c155699117be643a0 to your computer and use it in GitHub Desktop.
Multiline string in pure Javascript
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
// Found on http://stackoverflow.com/a/5571069/3718694 | |
function mlString(f) { | |
return f.toString(). | |
replace(/^[^\/]+\/\*!?/, ''). | |
replace(/\*\/[^\/]+$/, ''); | |
} | |
var tennysonQuote = mlString(function() {/*! | |
Theirs not to make reply, | |
Theirs not to reason why, | |
Theirs but to do and die | |
*/}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment