Get started with esprima CDN

BSD-2-Clause licensed

Esprima is a fast and capable JS parser.

Tags:
  • ast
  • ecmascript
  • javascript
  • parser
  • syntax

Stable version

Copied!

How to start using esprima CDN


<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.cdnhub.io/esprima/4.0.1/esprima.min.js"></script>
  <title>Get started with esprima CDN - cdnhub.io</title>
</head>
<body>
  <script>
    const script = `
      const expression = 1 + 1;
    `;

    const parseTree = esprima.parse(script, { ecmaVersion: 6 });
    const result = esprima.evaluate(parseTree, { global: this });

    console.log('Parse Tree:', parseTree);
    console.log('Result:', result);
  </script>
</body>
</html>

All versions