Why we built this
Every developer has been there: you need to quickly verify what null ?? "default" returns, or whether 0 || false || "fallback" short-circuits correctly. The options are either opening DevTools, spinning up a REPL, or mentally simulating the JavaScript spec. None of those are fast.
expr started as an internal scratch tool — a single input box that ran Function('"use strict"; return (' + expr + ')') and printed the result. It was five lines of JavaScript. We added history. Then syntax highlighting on the result. Then an API so you could evaluate expressions from curl. At some point it became a real product.
The best developer tools feel like they were always there — you just needed someone to make them obvious.
What ships in v1.0
This release is the foundation. Everything you need to evaluate, understand, and integrate JavaScript expressions, with no configuration and no installation required.
+ - * / % **)
??)
=== !== < > <= >=)
? :)
GET
The evaluator in action
Open expr, type an expression, and press Enter. That's the whole interface. No accounts, no configuration, no JavaScript to import. The result appears instantly — success states in green, errors in red, with the evaluated source shown below.
Here are a few expressions worth trying on your first run:
// Arithmetic 2 ** 10 → 1024 17 % 5 → 2 // Logical short-circuit null ?? "fallback" → "fallback" 0 || false || "last" → "last" // Comparison "5" === 5 → false "5" == 5 → true // Ternary 42 > 10 ? "big" : "small" → "big"
Under the hood
The evaluator runs entirely in your browser using Function('"use strict"; return (' + expr + ')'). This is intentional — expr is a tool whose entire purpose is evaluating arbitrary JavaScript expressions. Strict mode catches a class of common mistakes (undeclared variables, duplicate parameters) while still allowing the full expression language.
Results are stored in localStorage so your history persists across sessions. No server round-trip, no account required — your expressions never leave your machine unless you explicitly use the API.
The REST API
For server-side and CI use cases, expr ships a REST API that accepts any expression and returns a structured JSON response. Authentication uses a static API key passed in the Authorization header.
# Simple GET request curl "https://api.expr.dev/v1/evaluate?expr=2**10" \ -H "Authorization: Bearer YOUR_KEY" # Response { "ok": true, "result": 1024, "type": "number", "expr": "2**10" }
Error responses follow the same schema — ok: false with a human-readable error field and an errorType for programmatic handling. See the operator reference for the full list of evaluable expressions and their expected return types.
What's next
v1.0 covers the core expression set. Here's what's on the roadmap for v1.1 and beyond:
- Variable bindings — pass a
varsobject to the API and reference them in expressions (x * y + z) - Batch evaluation — send an array of expressions in one request, get an array of results
- Webhooks — trigger an expression evaluation on a schedule or in response to an external event
- Editor plugins — VS Code extension to evaluate the expression under the cursor inline
If there's something you'd like to see, let us know. The roadmap is shaped almost entirely by what developers actually need.