微信小程序视图层WXS_变量

时间:2018-07-05 19:43:42   收藏:0   阅读:250

微信小程序视图层WXS_小程序变量

微信小程序变量的概念

var foo = 1;
var bar = "hello world";
var i; // i === undefined

上面代码,分别声明了 foo、 bar、 i 三个变量。然后,foo 赋值为数值 1 ,bar 赋值为字符串 "hello wolrd"。

变量名

微信小程序的变量命名必须符合下面两个规则:

保留标识符

以下标识符不能作为

微信小程序

的变量名:

delete 
void 
typeof

null 
undefined 
NaN 
Infinity 
var

if 
else 

true 
false

require

this 
function 
arguments
return

for
while
do
break
continue
switch
case
default
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!