Last active
July 16, 2017 08:48
-
-
Save kephin/fb66cfda50bb5ecf957f8ecda12122f1 to your computer and use it in GitHub Desktop.
課後練習題
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(){ var a = b = 3; })(); | |
| //此function等同於 | |
| (function(){ | |
| var a = 3; | |
| b = 3; | |
| })(); | |
| // 所以此IIFE執行完後,在function內宣告的變數a會立即被回收 | |
| a; // -> Error: not defined | |
| // 但是沒有宣告b,所以b是window內的全域屬性 | |
| b; // -> 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment