Function was used before it was defined - JSLint

后端 未结 3 1247
一向
一向 2021-01-04 08:58

JSLint does not like this code saying \"\'b\' was used before it was defined\"

var a = function () {
        b();
    },

    b = function () {
        alert         


        
3条回答
  •  爱一瞬间的悲伤
    2021-01-04 09:17

    In C it is what we call forward declaration, looks like it could be the same in JSLint. JSLint is aware of b and at that point b could be a function for all it cares (but if it isn't a function, it would throw an error of course)

提交回复
热议问题