Function was used before it was defined - JSLint

后端 未结 3 1265
一向
一向 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:18

    If your code is well-written and object-oriented, it is possible to declare your functions before they are used. But JSLint sets a lot of standards that really have little relevance to the functionality of your application, and I really doubt there are any performance implications declaring functions one way or the other.

提交回复
热议问题