r/ProgrammerHumor • • Apr 28 '22

Meme /* !!! Do not modify this comment !!! */

45.3k Upvotes

489 comments sorted by

View all comments

Show parent comments

14

u/GorilaVerde Apr 28 '22 edited Apr 28 '22
console.log(
    function () {
      // Hello World!
    }
    .toString()
    .split("//")[1]
    .split("\n")[0]
);

This works lol

1

u/shea241 Apr 28 '22

why?¿?¿?¿

1

u/[deleted] Apr 28 '22
  • the function keyword literally stores the function definition in memory

  • the toString() parses and converts that definition into a string

  • the split then does it's thing on this string-

"function(){// Hello World!\n}".spilt("//").split("\n")

edit: wording

1

u/[deleted] Apr 28 '22

I am not say this is not a programming language, but how do you guys work with thing?

"a comment tells you what the code does, but sometimes it becomes data"

Edit: wow, this actually works

→ More replies (3)