Js局部变量
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Js</title> </head> <body> <script type="text/javascript"> function myFun(){ var temp = 10; //局部变量 } alert(temp); </script> </body> </html>上面的代码是有问题的,在函数myFun()函数中定义了temp变量,是局部变量,只能在当前函数中使用。
相关推荐
Android开发CXY 2020-11-11
yutian0 2020-10-26
PythonMaker 2020-07-05
goodriver 2020-06-17
程序媛一枚 2020-05-26
zhouxihua0 2020-04-15
Leewoxinyiran 2020-03-06
sunskyday 2020-02-01
wyqwilliam 2019-12-13
xcguoyu 2019-12-06
陈希章中国 2010-05-27
宿舍 2019-11-11
yfisaboy 2019-11-07
luckymaoyy 2019-11-06
azhou 2019-11-04
xcguoyu 2019-11-02
georgeandgeorge 2019-11-01
xiaoemo0 2019-10-22