Programming concepts

Capped exponential backoff

Try the free JavaScript compiler

Illustrative deterministic delay calculation before jitter. The cap and index must be validated in production.

Formal Syntax & Structure

javascript syntaxjavascript
Math.min(cap, base * 2 ** retryIndex)

Return Value

number

Computed delay.

Working Example

Example Snippetjavascript
(async () => {const delay=i=>Math.min(800,100*2**i);console.log(JSON.stringify([0,1,2,3,4].map(delay)));})()
JavaScript Reference