padStart / padEnd Playground

Book spine labels: padStart and padEnd fill up to a target length, the pad tiles coloured. And what about a value already longer than the target? An…

Why it matters

Leading zeros, lined-up columns, masks: they show up all over a UI (clocks, invoices, tables, IDs). Without padding, people write their own logic, prone to off-by-one. padStart/padEnd is one clear, correct line.

The key idea

Padding fills up to a TARGET length, not N more characters

Try it in this playground