Get js script file path problem

    var jsPath = doc.currentScript ? doc.currentScript.src : function(){
      var js = doc.scripts
      ,last = js.length - 1
      ,src;
      for(var i = last; i > 0; i--){
        if(js[i].readyState === "interactive"){
          src = js[i].src;
          break;
        }
      }
      return src || js[last].src;
    }();

Why should we judge this js[ I] .readyState = "interactive"?" here? Can"t I get the last src directly? And it is found that js[ I] .readyState is basically underfind

.
Mar.12,2021

may be dealing with the problem of script asynchronous loading.

Menu