0

Get Maximum Call Stack Size

Function JavaScript 1 revisions 112 7 months ago 7 months ago
function getStackSize() {
    let i = 0;
    let hi;
    hi = () => ++i && hi();
    try {
        hi();
    } catch (e) {
        return i;
    }
}

It works by exhausting the stack. It's stupid but it works.