# JS-Interpreter Babel Demo

A transpiler is required to run ES6 or greater using the JS-Interpreter. Babel is a good option which can generate ES5 either client-side or server-side.

For client-side transpiling, download @babel/standalone and include it as a script tag on your page. Then convert your code like this:

    code = Babel.transform(code, {'presets': ['es2015']}).code;

One issue is that highlighting the user's code as it executes won't work since it is the transpiled code that's actually being executed and the line numbers won't match.

Type some ES6, click Parse, then click Run once. Open your browser's console for errors.

const result = []; const fibonacci = (n, output) => { let a = 1, b = 1, sum; for (let i = 0; i < n; i++) { output.push(a); sum = a + b; a = b; b = sum; } } fibonacci(16, result); alert(result.join(', '));

Back to the JS-Interpreter documentation.