WTFJS: A Handbook of JavaScript's Weirdest Edges, Packaged as an npm Manual
🤪 A list of funny and tricky JavaScript examples
At a glance
- What is it?
- WTFJS is a community-maintained list of quirky JavaScript examples, installable as a global npm package that opens a paged manual in your terminal. It is a reference for beginners and professionals alike, but it is not a tutorial or a benchmark of language quality.
- Who is it for?
- Adopt WTFJS if you are a JavaScript developer who wants a quick, entertaining refresher on coercion, prototypes, and other edge cases, or if you teach and need concrete examples to spark discussion. Skip it if you need a structured tutorial, a curated list of best practices, or a spec-level deep dive, because the examples are intentionally brief and some explanations are incomplete.
- Can I use it commercially?
- Yes. WTFPL is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 41 days ago.
- What is it written in?
- Mainly JavaScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- denysdovhan/wtfjs37,693 ★ · +18
| Repository | 2026-08-18 | 2026-11-15 |
|---|---|---|
| denysdovhan/wtfjs | 37.7k | 37.7k |
18 Stars in the last 89 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What WTFJS Actually Is and Who It Serves
WTFJS is a single Markdown document that collects JavaScript examples where the language behaves in a surprising or counterintuitive way. The README describes it as "a list of funny and tricky JavaScript examples". It is not a library, a framework, or a testing tool. It is a handbook. The audience is twofold. Beginners are told they can use the notes to "get a deeper dive into JavaScript" and to be motivated to read the specification. Professionals are told they can treat the examples as "a great reference for all of the quirks and unexpected edges". The tone is playful, but the content is serious in its intent: each example is meant to be explained, not just mocked. The project is inspired by Brian Leroux's 2012 dotJS talk of the same name, which gives it a lineage that predates most current JavaScript tooling.
How the Handbook Is Structured and What It Covers
The document is organized as a table of contents with over fifty entries. Each entry is a short code snippet followed by an explanation. The topics cluster around core language mechanics. Coercion appears early: `[]` is equal to `![]`, `true` is not equal to `![]`, and `null` is falsy but not `false`. Type conversion shows up in examples like `parseInt` being "a bad guy" and `Math.max()` being less than `Math.min()`. Prototypes and constructors get several entries, including `String` instances, `__proto__` access, and a `constructor` property. There are also examples that touch on syntax edge cases, such as trailing commas, labels, and the infamous semicolon issue. The list includes async behavior with `setTimeout`, Promise `resolve()` behavior, and an "infinite timeout". The range is broad enough that almost any JavaScript developer will find at least one example they have not seen before.
Installing and Running It as a Terminal Manual
The project is distributed as an npm package. The README gives a single command: `npm install -g wtfjs`. After that, you run `wtfjs` at the command line. The command opens the manual in your selected `$PAGER`, which is the environment variable that controls the terminal pager program, typically `less` or `more`. This design is unusual. Most documentation lives on a website or in a README. Here, the author chose to make the handbook a first-class command-line tool. The source remains on GitHub at `https://github.com/denysdovhan/wtfjs`, so you can also read it in a browser. The npm route is convenient for offline reading. The package version is 1.22.8, released on 2022-09-30, and the last push to the repository was on 2026-10-05.
The Role of Translations and Their Maintenance Caveats
The README lists seven translations: Chinese, Hindi, French, Brazilian Portuguese, Polish, Italian, and Korean. Each translation is a separate file in the repository, such as `README-zh-cn.md` and `README-hi.md`. The note is explicit: "Translations are maintained by their translators. They may not contain every example, and existing examples may be outdated." This is a genuine limitation. If you rely on a translation, you may miss recent additions or find that a translated example no longer matches the current English version. Because each translation is maintained separately by its translators, the risk of drift is real. If you are a non-native English speaker, the English original is safer, even if it is less comfortable.
Where the Explanations Fall Short and Why That Matters
The README states the primary goal is to "collect some crazy examples and explain how they work, if possible." That conditional "if possible" is telling. This is a reference, not a textbook. If you need a rigorous explanation of coercion rules or the `ToPrimitive` abstract operation, you will have to open the ECMAScript spec yourself. The README even encourages that: it says the notes should motivate you to "spend more time reading the specification." So the document is a starting point, not an endpoint.
A Real Alternative: The ECMAScript Specification and MDN
If WTFJS is too terse, the obvious alternative is the ECMAScript Language Specification, often called ECMA-262. The difference in approach is stark. WTFJS gives a concrete code snippet and a short explanation, often with a joke. The spec gives formal algorithms, abstract operations, and normative language. For example, WTFJS has an entry on the precision of `0.1 + 0.2`. The spec's `Number::add` algorithm defines how the addition is performed, including rounding to the nearest representable value. Another alternative is the MDN Web Docs, which provides practical articles on operators and type coercion, with browser compatibility tables. MDN is more approachable than the spec but still more structured than WTFJS. If you are debugging a real issue, MDN is usually faster. If you want to be surprised and learn something you did not know you did not know, WTFJS is better.
Licence, Maintenance, and Upgrade Costs
The project is licensed under WTFPL 2.0, which is the Do What The Fuck You Want To Public License. That means there are essentially no restrictions on copying, modifying, or redistributing the content. This is permissive to an extreme, but it also means there is no warranty or liability protection. The repository's last release was v1.22.8 on September 30, 2022, while the last push was on 2026-10-05. If you install the npm package, you are getting the snapshot from that 2022 release. The examples are mostly about language semantics that have been stable for years, so the lack of updates is not a critical problem. However, newer JavaScript features, such as `Array.prototype.at` or `Object.hasOwn`, are not covered. If you want to know how those behave in edge cases, you will not find it here. The upgrade cost is effectively zero because the package is a single document, but the value also does not grow over time.
Editorial conclusion
Adopt WTFJS if you are a JavaScript developer who wants a quick, entertaining refresher on coercion, prototypes, and other edge cases, or if you teach and need concrete examples to spark discussion. Skip it if you need a structured tutorial, a curated list of best practices, or a spec-level deep dive, because the examples are intentionally brief and some explanations are incomplete. Before relying on it, verify each example against your target Node or browser version, since the language evolves and the last npm release dates from September 2022. Treat it as a starting point for reading the ECMAScript specification, not as a substitute for it.
Frequently asked questions
How do I install wtfjs?
Run npm install -g wtfjs, then run wtfjs at the command line, which opens the manual in your selected $PAGER. The source is at https://github.com/denysdovhan/wtfjs, and the README notes you can keep reading there instead.
What licence is wtfjs released under?
WTFPL 2.0. package.json declares the license field as WTFPL 2.0, the README carries a matching badge, and a LICENSE file sits in the repository root alongside a License section at the end of the document.
Is the wtfjs npm package up to date with the repository?
Not necessarily. The newest release is v1.22.8 from 2022-09-30, after v1.22.7 and v1.22.6 on 2022-04-26, while the repository's last push was on 2026-10-05. Running wtfjs prints the packaged text, so check README.md in the repository for the current version of an entry.
What does npm test run in the wtfjs project?
The test script is prettier --check ., a formatting check rather than a test suite, and there is no test file in the repository. The other scripts are toc for regenerating the table of contents with doctoc, format for prettier --write ., release for semantic-release, and prepare for husky install.
Are the wtfjs translations complete and current?
The README states that translations are maintained by their translators, that they may not contain every example, and that existing examples may be outdated. Seven are named in the list, and the repository tree also contains a README-si.md that the list does not mention.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/denysdovhan-wtfjs)Star history chart for your README
[](https://hysenlabs.com/projects/denysdovhan-wtfjs)Was this useful?