1,當即執行函數就是定義後立刻就執行的函數,用來隔絕做用域使 _foo 沒法在外部被訪問閉包
_foo
2,函數訪問了函數外面的變量,這二者就造成了閉包get() 與 _foo 造成了閉包函數
get()
(function() { var _foo = 1 window.get = function() { return _foo } })() console.log('閉包 get', get())