Skip to content

Instantly share code, notes, and snippets.

@tfanme
Created October 10, 2013 08:23
Show Gist options
  • Select an option

  • Save tfanme/6914897 to your computer and use it in GitHub Desktop.

Select an option

Save tfanme/6914897 to your computer and use it in GitHub Desktop.
JavaScript: 显式声明
// 声明变量 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