Tool · JavaScript
Type explorer
Two values and an operator in. The result, its type and each conversion step out, computed by JavaScript as you choose.
Open the explorer on its own page, full width, which suits a phone.
How to use it
- Operator: pick a left value, an operator (
==,===,+,-,&&,||or??) and a right value. Read the result and its type, then the steps, each named for the part of the ECMAScript specification it comes from. Predict the result first, then check. - == matrix:
==for every pair of the same values. The grid scrolls inside its own box. Choose a cell to open that pair in operator mode. With a keyboard, tab into the grid, move with the arrow keys, and press Enter. - One value: pick a value and read
typeof,Number(),String()andBoolean(), with the reason for each.
The values come from a fixed list of the awkward ones. Nothing you type is run. A pair is two separate literals, so [] against [] compares two different arrays. The results come from the real operators, in type-explorer.js, and a test checks every stated result and conversion against JavaScript for every pair.
Learn more
- Types and coercion: the conversion tables,
+against the other operators,==against===, andNaN. - The JavaScript section.
- The specification's IsLooselyEqual and ApplyStringOrNumericBinaryOperator, the algorithms the steps follow.
