JavaScript Expression Evaluator
Evaluates one expression per line and shows the result of each beside it.
Loading the tool…
How to use this tool
- Write one expression per line. Blank lines and lines starting with // are ignored.
- Declare a name on an early line if later lines need it — const, let, var, function and class lines all work, and every line shares one sandbox.
- Select Evaluate every line.
- Copy the table, or download it as CSV to keep the results beside the expressions.
What javascript expression evaluator does
Opening the browser console to check what `0.1 + 0.2` gives, or what `[..."hello"].reverse().join("")` produces, means losing whatever you were looking at. This page is the scratchpad instead: write one expression per line and every answer appears beside its expression in a table you can copy or download as CSV.
All the lines are evaluated in a single sandbox, in order, so a line that declares something — const, let, var, function or class — is emitted as a real declaration and the name is still in scope further down, which is how a scratchpad is actually used. A declaration line shows the value it was given. An expression that throws does not stop the rest; its error is shown in place and the run continues, so one typo does not cost you the other nineteen answers. Values are formatted rather than stringified, so an array stays an array and an object shows its keys.