Created
June 9, 2019 09:39
-
-
Save LinZap/e072a371005c9aa6284a6667361bd02e to your computer and use it in GitHub Desktop.
Node.js - HK5
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
let width = 200; | |
function delayPrintWidth(ms) { | |
let w = width | |
setTimeout(() => console.log(w), ms) | |
} | |
delayPrintWidth(1000); // 預期印 200 | |
width = 300; | |
delayPrintWidth(2000); // 預期印 300 | |
width = 400; | |
delayPrintWidth(3000); // 預期印 400 |
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
200 | |
300 | |
400 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment