We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
语句结尾的分号 ; 表示语句的结束,是可以省略的,但是建议都写上
;
声明变量:
var pi = 3.14;
var __timer = setInterval("timer()", 1000);
匿名函数(存储在变量中的函数不需要函数名称。它们总是使用变量名称调用):
// The function ends with a semicolon because it is a part of an executable statement. var x = function (a, b) { return a * b; }; var z = x(4, 3);
(BOM) window 对象的 setInterval() 方法中使用匿名函数:
setInterval()
setInterval(function() { alert("Hello"); }, 3000);
逗号 , 用于内容分隔
,
声明多个变量:
var name="Fatli", age=22, job="programmer";
数组中的多个值
var cars = ["Tesla", "BMW", "Lamborghini"];
分隔对象属性(键值对):
var person = {firstName:"Ben", lastName:"Fatli", age:22, eyeColor:"black"};
函数 {} 后的分号建议省略,因为 } 就代表一条完整语句的结束
{}
}
function name(parameter1, parameter2, parameter3) { code to be executed }
—— 拓展:Javascript编程风格
The text was updated successfully, but these errors were encountered:
No branches or pull requests
语句结尾的分号
;
表示语句的结束,是可以省略的,但是建议都写上声明变量:
匿名函数(存储在变量中的函数不需要函数名称。它们总是使用变量名称调用):
(BOM) window 对象的
setInterval()
方法中使用匿名函数:
逗号
,
用于内容分隔声明多个变量:
数组中的多个值
分隔对象属性(键值对):
函数
{}
后的分号建议省略,因为}
就代表一条完整语句的结束—— 拓展:Javascript编程风格
The text was updated successfully, but these errors were encountered: