Concepts

Bounded exponential reconnect delay

Try the free JavaScript compiler

Illustrative deterministic retry delay for a bounded nonnegative attempt index; production policies may add jitter.

Formal Syntax & Structure

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

Return Value

number

Illustrative deterministic retry delay for a bounded nonnegative attempt index; production policies may add jitter.

Working Example

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