Skip to content

Instantly share code, notes, and snippets.

@sjswitzer
Created October 31, 2013 00:11
Show Gist options
  • Save sjswitzer/7242488 to your computer and use it in GitHub Desktop.
Save sjswitzer/7242488 to your computer and use it in GitHub Desktop.
Javascript / Node.js Quine
a="console.log(\"a=\"+JSON.stringify(a)+\";\"+a)";console.log("a="+JSON.stringify(a)+";"+a)
@sjswitzer
Copy link
Author

This is shorter but feels like cheating:

a="console.log("a="+JSON.stringify(a)+";eval(a)")";eval(a)

@sjswitzer
Copy link
Author

In a trivial sense, the empty file is a JavaScript quine. Clearly the shortest.

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