<x-ample> examples

Click on the code to edit. Once you blur the textarea, the code becomes live.

Simple value-returning code

HTML output

Returned values are shown using the Element.prototype.append.

Multiple values

Returned array is spread out as individual arguments to Element.prototype.append.

Long-running code

The code is wrapped inside an asynchronous generator. This means that:

  1. It is possible to yield multiple times (every yield replaces the previous value)
  2. You can use await