JavaScript REPL

Run JavaScript over the loaded rows locally — filter, map, reduce — with no AWS cost.

The JavaScript REPL (the Console JS panel) lets you run arbitrary JavaScript over the items currently loaded in the grid, entirely on your machine — handy for slicing, summarizing and inspecting data without crafting a query.

Opening the console

Click Console JS in the grid toolbar. The panel opens with the loaded rows already in scope as rows, and shows how many items are available — for example Console JS · 1,240 items.

The REPL runs locally over the loaded rows only (rows) — it makes no AWS calls and costs nothing. It sees exactly what’s in the grid: the result of your active scan, query or PartiQL statement, after any quick-filter.

Writing code

rows is a plain JavaScript array of objects. Write an expression or a small script that returns a value:

  • Single expression — gets an implicit return:

    rows.filter(r => r.amount > 100)
  • Multi-statement — must return explicitly:

    const byStatus = {};
    for (const r of rows) byStatus[r.status] = (byStatus[r.status] || 0) + 1;
    return byStatus;

Press Ctrl+Enter (or click run) to execute. The result is pretty-printed as JSON below, with a type hint (e.g. array · 87 items). Errors are shown in red with the message from the failing code.

Snippets

The panel ships with one-click starter snippets to get going:

SnippetCode
Countrows.length
Samplerows.slice(0, 5)
Unique[...new Set(rows.map(r => r.status))]
Filterrows.filter(r => r.amount > 100)
Sumrows.reduce((a, r) => a + (r.amount || 0), 0)

Click one to drop it into the editor, then adapt it. These map directly to common questions — how many?, what are the distinct values?, what’s the total? — that would otherwise need a scan plus post-processing.

The result panel adapts to what you return. An array shows its length; an object is pretty-printed; a primitive prints as-is. Because the output is JSON-formatted, you can copy a filtered or reshaped subset straight out of the result pane and paste it into a file, an import, or a script. The panel can be expanded to a larger size when a result is long.

When to reach for it

The REPL shines for ad-hoc analysis the query language can’t express conveniently: cross-attribute math, grouping, deduplication, reshaping items, or spot-checking a hypothesis before you commit to a real query. Because it’s rows.filter / .map / .reduce over data you already have, iteration is instant and free — there’s no round-trip to AWS and no read capacity consumed, so you can refine an expression dozens of times without thinking about cost. It’s also a natural way to sanity-check a bulk transform before running it: prototype the per-item logic here against rows first, then move it into the bulk panel where it runs over the matched items and writes back.

For the same model applied to writes — running a per-item JavaScript transform across matched items and committing the results — see the transform mode in bulk operations. For column math without code, the aggregate bar covers SUM/AVG/COUNT/DISTINCT.

Limitations to keep in mind

  • The REPL operates on loaded rows only. To analyze the whole table, load it all first (streaming with a high limit, or repeated load more) — the console never fetches on its own.
  • It’s read-only: returning a value displays it; it does not write anything back to DynamoDB. Use the grid’s staged edits or bulk transform to persist changes.
  • Code runs as plain JavaScript on your machine — there’s no DynamoDB context, just the rows array.