• zygo_histo_morpheus@programming.dev
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    1 day ago

    This reminds me of a trick to get multiline strings in javascript before they where formally introduced. If you coerce a function in to a string you get the source code for that function, comments and all. This meant that you could write a function with multiline comments and then pick out the middle part. Haven’t tested it so it’s probably sligthly wrong but it was something like:

    var multiLine = ('' + function () {/*
    line 1
    line 2
    */});
    multiLine = multiLine.substring(16, multiLine.length-4);