"Maximum call stack size exceeded" in JavaScript — What It Means and How to Fix It

What the JavaScript error "Maximum call stack size exceeded" means and how to fix it.

Published October 29, 2026

"Maximum call stack size exceeded" is occurs when a function calls itself (directly or indirectly) too many times without reaching a base case.

Key points

  • Check the browser console's stack trace to find exactly which line and call triggered the error

Example

function f() { return f() }
f()  // RangeError: Maximum call stack size exceeded
More JavaScript articles