How does the load() function allow the user to provide a callback?

前端 未结 6 798
再見小時候
再見小時候 2020-12-30 13:27

In javascript it\'s very popular for libraries/frameworks to let us define a callback function for post-processing of data.

eg.

load(\"5\", function(         


        
6条回答
  •  梦谈多话
    2020-12-30 13:55

    function(callback,argumentArray) {
        var result = callback.apply(this,argumentArray);
    }
    

    Points to be noted:

    • this can be null. In that case if this is used in the callback implementation then it would point to the Global object.
    • argumentArray is actually a JavaScript Array of arguments required by the callback method.

提交回复
热议问题