Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Multi-Line Strings in JavaScript

Multi-line strings in JavaScript

Playing around with concepts shown by Sindre Sorhus in, which had some optimizations that confused me about the idea's basis.

Paste me into your JavaScript console:

var getMultiLineString = function(func) { 
  var ret, str, temp;
  ret = '';
  if (typeof func === 'function') {
    str = func.toString();
    if (str) {
      temp = str.split('/*');
      if (temp[1]) {
        ret = temp[1].split('*/')[0];
  return ret;

var testme = (function(){/*

// some html to render



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment