首页 > javascript中这一步是把一个函数赋给一个变量?

javascript中这一步是把一个函数赋给一个变量?


我觉得这个应该是接口的实现。接口就是一个没有参数的方法。


可以看作C语言的函数指针,这条语句相当于

request.addEventListener('readystatechange', function () {
    ...
})

是的


不是~~
是将一个匿名函数赋值给一个对象的某个属性,或将一个对象的某个属性指向一个匿名函数对象
javascript中函数式一等公民,可以赋值给任何变量及一个对象的任何属性


The XMLHttpRequest.onreadystatechange property contains the event handler to be called when the readystatechange event is fired, that is every time the readyState property of the XMLHttpRequest changes. The callback is called from the user interface thread.

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/onreadystatechange
http://www.w3school.com.cn/ajax/ajax_xmlhttprequest_onreadystatechange.asp

【热门文章】
【热门文章】