javascript在使用递归函数时有警告工具吗

问题描述 投票:0回答:0

我想要一个扫描递归函数的工具。我要解决的问题是当前项目中有一些多层递归函数,编码时没有发现,容易造成死循环

特殊情况:

var beforeAdd;

function add (a, b) {
    if (a < 10) {
        return beforeAdd(a + 1, b);
    }
    return a + b;
}

function beforeAdd (a, b) {
    return add(a, b + 1);
}

add(1, 2);

// warning Line 6 used recursion function, Please confirm whether the recursion function is correct
javascript
© www.soinside.com 2019 - 2024. All rights reserved.