wtfjs
🤪 A list of funny and tricky JavaScript examples
WTFJS: the fun side of JavaScript's tricky parts
A list of funny and tricky JavaScript examples, tracing its original idea to Brian Leroux's WTFJS talk at dotJS 2012 and licensed under WTFPL.
What the list is for
The README frames JavaScript as a great language with simple syntax and, most important, a great community. Then it admits the truth: JavaScript is also a funny language with tricky parts, some of which turn everyday work into trouble and some of which make people laugh. The repository collects those examples, and the motivation line quotes Linus Torvalds, Just for Fun, with the goal of gathering crazy examples and explaining how they work. The license is WTFPL 2.0, and support options like Patreon and Buy Me A Coffee are linked.
Where the idea came from
The original idea belongs to Brian Leroux, and the list is highly inspired by his WTFJS talk at dotJS 2012. That lineage is credited directly in the README. There is also a short URL for the JavaScript examples on the homepage, and translations are handled through a contributing file, with a note that translators maintain their own versions, which may miss examples or fall out of date.
Reading it your way
The collection runs as a Node packaged manuscript. Running wtfjs at the command line opens the manual in the selected pager, or it can simply be read on the page. For beginners the notes are a way to dive deeper into JavaScript and spend more time with the specification; for professionals they are a reference for the quirks and unexpected edges of the language. Either way, the table of contents gives a taste, starting with entries like an empty array being truthy but not true.
Editorial conclusion
WTFJS is entertainment with a specification attached. Every example is framed as a lesson about how JavaScript actually behaves, and the talk credit keeps the collection anchored to a real origin.
Community notes