我想访问javascript嵌套函数中的全局变量,并在嵌套函数中附加一些值,并将该变量显示在嵌套函数之外,并在嵌套函数中附加值
例如:
function a()
{
var res="";
function b()
{
res=res+"hello";
alert(res); //alert dialog with hello is appearing
}
alert(res); //empty alert dialog is appearing,but I want this alert to
display hello,means "res" must act as global variable.
}
你能给出这个解决方案吗.....