UNPKG

ridder

Version:

A straightforward game engine for simple data-driven games in JavaScript

9 lines (8 loc) 292 B
/** * Create a new table data structure. * A table is a fixed-size read-only array that is used to store a collection of items. * One can zero an object in the table to reuse it. */ export function table(length, fill) { return Array.from({ length }).map((_, index) => fill(index)); }