Check JavaScript syntax without executing the code.
Check whether JavaScript code is syntactically valid, with the line and column of the first problem. It parses the code and never executes it, so you can safely check snippets from any source, as scripts or ES modules.
Syntax validation parses source text against the language grammar and reports where it breaks the rules, such as a missing bracket, an unexpected token or a duplicate let declaration. It does not run the code, so it cannot detect runtime errors like calling an undefined function, nor logic bugs, nor style problems. This tool uses the acorn parser with the latest ECMAScript version. It first tries the code as a classic script and, if that fails, as an ES module, so import and export statements are accepted. Top-level return and await are tolerated, and a leading hashbang line is allowed. Because nothing is executed, checking is safe for untrusted code.
No. It is only parsed by acorn. Nothing in it is evaluated or run.
Yes. The parser targets the latest ECMAScript version, including async functions, optional chaining and classes.
The code failed as a script but parsed as a module, usually because it contains import or export.
No. Those extensions are not standard JavaScript and are reported as syntax errors.
No. Syntax validity says nothing about what the code does when run.