[removed] How is “function onload() {}” different from “onload = function() {}”?

前端 未结 6 627
慢半拍i
慢半拍i 2021-02-02 11:37

In the answers to this question, we read that function f() {} defines the name locally, while [var] f = function() {} defines it globally. That makes p

6条回答
  •  旧时难觅i
    2021-02-02 12:14

    var onload = function() {
        alert("hello");
    }
    

    Will declare it locally too.

    I suggest you to read this very helpful article : http://kangax.github.io/nfe/

提交回复
热议问题