How can get a list of the functions in a javascript file?

后端 未结 4 1232
终归单人心
终归单人心 2021-01-20 14:18

I\'m trying to cobble together a php style include function for javascript. The route I\'m taking is through a XMLHttpRequest. The included file will load, but the functions

4条回答
  •  春和景丽
    2021-01-20 14:51

    Change the way you declare your functions and it should solve the scoping issue. Instead of:

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

    do this:

    var add = function(a, b) 
    {                     
        return a + b;
    }   
    

提交回复
热议问题