【发布时间】:2011-04-23 00:05:57
【问题描述】:
可能重复:
Javascript: is using 'var' to declare variables optional?
在javascript中创建变量时必须在变量名前添加“var”吗?
例如代替
var message = "Hello World!"
我可以用吗
message = "Hello World!"
?
我注意到像 Google Adsense 这样的脚本不使用 var
例子:
google_ad_width = 160;
google_ad_height = 600;
google_color_border = "000000";
google_color_bg = "ffffff";
【问题讨论】:
-
我根据您的问题的标题搜索了 SO。这是我收到的第一个结果:stackoverflow.com/questions/2485423/…
标签: javascript variables