# denysdovhan/wtfjs

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/denysdovhan-wtfjs).**

37,742 stars · 2,692 forks · JavaScript · wtfpl

## Links

- GitHub: https://github.com/denysdovhan/wtfjs
- Homepage: http://bit.ly/wtfjavascript
- awesome-repositories: https://awesome-repositories.com/repository/denysdovhan-wtfjs.md

## Topics

`book` `handbook` `javascript` `js` `learning` `notes` `specification` `wtf`

## Description

This project is an educational resource and technical reference archive focused on the core architecture and counter-intuitive behaviors of the JavaScript programming language. It provides a comprehensive collection of language edge cases, syntax anomalies, and runtime inconsistencies that challenge standard developer assumptions. By grounding these examples in the official ECMAScript specification, the repository serves as a guide for understanding the underlying mechanics of the language.

The project distinguishes itself by cataloging specific instances of type coercion, operator precedence, and prototype-based inheritance that often lead to unexpected outcomes. It covers a wide range of language quirks, including non-obvious truthy or falsy evaluations, complex object property access, and inconsistencies in standard library methods. These examples are designed to help developers navigate the nuances of the dynamic type system and lexical environment binding.

Beyond its role as a reference for language mastery, the repository functions as a tool for debugging and technical interview preparation. It offers detailed explanations for why specific expressions behave as they do, helping users resolve complex bugs and deepen their understanding of how the language is parsed and executed. The content is structured to facilitate learning through direct observation of language anomalies and their corresponding specification-based justifications.

## Tags

### Programming Languages & Runtimes

- [Language Specifications](https://awesome-repositories.com/f/programming-languages-runtimes/language-specifications.md) — JavaScript core architecture concepts including type coercion, lexical scoping, prototype inheritance, and operator precedence defined by official runtime specifications. ([source](https://github.com/denysdovhan/wtfjs/blob/master/README.md))
- [Specification Compliance Suites](https://awesome-repositories.com/f/programming-languages-runtimes/specification-compliance-suites.md) — Language behavior is strictly governed by the official standard, which defines specific runtime semantics for operators and type conversions.
- [Dynamic Type Systems](https://awesome-repositories.com/f/programming-languages-runtimes/dynamic-type-systems.md) — Variables and expressions are evaluated at runtime, where types are coerced automatically based on the context of the operation.
- [Language Guides](https://awesome-repositories.com/f/programming-languages-runtimes/language-guides.md) — Deepening understanding of core language mechanics, edge cases, and specification quirks to write more predictable and robust code.
- [Language Mechanisms](https://awesome-repositories.com/f/programming-languages-runtimes/language-mechanisms.md) — Objects inherit properties and methods from a prototype chain, allowing for dynamic modification of core language behavior at runtime.
- [Language Quirks](https://awesome-repositories.com/f/programming-languages-runtimes/language-quirks.md) — JavaScript language quirks including type coercion anomalies, operator inconsistencies, and non-obvious syntax behaviors that challenge standard developer assumptions about runtime execution. ([source](https://github.com/denysdovhan/wtfjs/blob/master/README.md))
- [Lexical Scoping Engines](https://awesome-repositories.com/f/programming-languages-runtimes/lexical-scoping-engines.md) — Functions and blocks maintain scope through internal records that determine how variables and identifiers are resolved during execution.
- [Language Reference Guides](https://awesome-repositories.com/f/programming-languages-runtimes/language-reference-guides.md) — A structured repository of language specifications and edge cases that explains how specific syntax and operators function under the hood.
- [Type Coercion Mechanisms](https://awesome-repositories.com/f/programming-languages-runtimes/type-coercion-mechanisms.md) — Values are implicitly converted to primitives using internal rules before comparison, often resulting in unexpected truthy or falsy outcomes.

### Education & Learning Resources

- [Interview Preparation Guides](https://awesome-repositories.com/f/education-learning-resources/interview-preparation-guides.md) — Reviewing common language pitfalls and counter-intuitive behaviors often used to test depth of knowledge in developer assessments.
- [JavaScript Learning Resources](https://awesome-repositories.com/f/education-learning-resources/javascript-learning-resources.md) — Provides detailed technical explanations of JavaScript language quirks and syntax behaviors to clarify common developer misunderstandings. ([source](https://github.com/denysdovhan/wtfjs/blob/master/README.md))
- [Language Concepts](https://awesome-repositories.com/f/education-learning-resources/language-concepts.md) — Provides detailed explanations of specific language behaviors and truthiness rules to clarify common developer misconceptions. ([source](https://github.com/denysdovhan/wtfjs/blob/master/README.md))
- [Language Learning Guides](https://awesome-repositories.com/f/education-learning-resources/language-learning-guides.md) — Have you ever tried to split a string by a space? ```js "".split(""); // -> [] // but… "".split(" "); // -> [""] ``` ### Explanation: This is expected behaviour. Its responsibility is to divide the input string every tim ([source](https://github.com/denysdovhan/wtfjs/blob/master/README.md))
- [Language Learning Resources](https://awesome-repositories.com/f/education-learning-resources/language-learning-resources.md) — Let's do some math: ```js true + true; // -> 2 (true + true) * (true + true) - true; // -> 3 ``` Hmmm… ### Explanation: We can coerce values to numbers with the `Number` constructor. It's quite obvious that `true` will b ([source](https://github.com/denysdovhan/wtfjs/blob/master/README.md))
- [Language Quirks](https://awesome-repositories.com/f/education-learning-resources/language-quirks.md) — Type of `NaN` is a `'number'`: ```js typeof NaN; // -> 'number' ``` ### Explanation: Explanations of how `typeof` and `instanceof` operators work: - **12.5.5** The `typeof` Operator - **12.10.4** Runtime Semantics: Insta ([source](https://github.com/denysdovhan/wtfjs/blob/master/README.md))
- [Language Reference Guides](https://awesome-repositories.com/f/education-learning-resources/language-reference-guides.md) — Provides detailed explanations and comparative examples of JavaScript equality operators and their specific edge cases. ([source](https://github.com/denysdovhan/wtfjs/blob/master/README.md))

### Software Engineering & Architecture

- [Language Specification Research](https://awesome-repositories.com/f/software-engineering-architecture/language-specification-research.md) — Exploring the underlying rules of the ECMAScript standard to understand why specific syntax and operators behave in non-obvious ways.
