# Interpreter - JavaScript Interactive Interpreter

This demo is a JavaScript interpreter. Type some code into the text input and press enter to see the results. It uses MochiKit's MochiKit.DOM to manipulate the display. It also supports waiting for MochiKit.Async Deferreds via `blockOn(aDeferred)`.

View Source: [ index.html | interpreter.js ]
Notes:

- To show the signature of a MochiKit function and link to its documentation, type help(fn) on any MochiKit function.
- To write multi-line code snippets, use the lower text area and press ctrl-enter or cmd-enter to submit.
- `function name() {}` syntax might not end up in window scope, so use `name = function () {}` syntax instead
- If you want to stuff something into the output window other than the `repr(...)` of the expression result, use the `writeln(...)` function. It accepts anything that MochiKit.DOM does, so you can even put styled stuff in there!
- Use `clear()` to clear the interpreter window.
- You can use `blockOn(aDeferred)` to wait on a Deferred. This expression must be used by itself, so the value must be obtained from `_` or `last_exc`. Typing any expression will cancel the Deferred.
- Up and down arrow keys work as a rudimentary history
- `_` is the value of the last expression that was not `undefined`, `last_exc` is the value of the last unhandled exception.