JavaScript Validator

Parse JavaScript and get the exact line and column of the first syntax error, with a short profile when the code is clean.

JavaScript
Result
Runs locally in your browser

About the JavaScript Validator

A missing bracket in a 400-line file is a needle in a haystack, and the browser console's "Unexpected token" is not always precise. This validator runs the code through terser's parser, which supports the latest ECMAScript syntax, and reports the first syntax error with line, column and message. The position is highlighted in the editor.

When the code parses, the result shows a few facts that help sanity-check a paste: line count, an approximate function count, the number of console calls, and any TODO or FIXME comments. Those are counts, not judgements; the tool does not run a style linter.

ES module mode, on by default, allows top-level import, export and await. Untick it for classic scripts where those are errors. To test code by running it, the JavaScript Runner executes it in a sandbox and shows console output.

How to use

  1. Paste the code.
  2. Read the error with its line and column, or the profile if the code is valid.
  3. Fix the reported line; the result updates as you type.

Common questions

Does it check for logic errors or undefined variables?
No. It checks syntax only. Undefined variables are a runtime or lint concern.
Is JSX supported?
No. JSX is not JavaScript syntax; validate it with the JSX Formatter, which reports parse errors.
Which language version is supported?
ES2023 including class fields, optional chaining, nullish coalescing, top-level await and regular expression flags such as v.