Created
October 10, 2013 08:23
-
-
Save tfanme/6914897 to your computer and use it in GitHub Desktop.
JavaScript: 显式声明
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
| // 声明变量 str 和 num | |
| var str = 'test'; | |
| var num = 3 + 2 - 5; | |
| // 声明变量 n | |
| for (var n in Object) { | |
| // ... | |
| } | |
| // 声明变量 i, j, k | |
| for (var i, j, k = 0; k<100; k++) { | |
| // ... | |
| } | |
| // 声明函数 foo | |
| function foo() { | |
| str = 'test'; | |
| } | |
| // 声明异常对象 ex | |
| try { | |
| // ... | |
| } | |
| catch(ex) { | |
| // ... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment