var myvalue="aaa";
/*相当于
function test(){
var myvalue=undefined;
alert(myvalue);
myvalue="bbb";
alert(myvalue);
}
*/
function test(){
alert(myvalue);
var myvalue="bbb";
alert(myvalue);
}
test();
测试结果是先弹窗undefined,后弹窗bbb
var myvalue="aaa";
/*相当于
function test(){
var myvalue=undefined;
alert(myvalue);
myvalue="bbb";
alert(myvalue);
}
*/
function test(){
alert(myvalue);
var myvalue="bbb";
alert(myvalue);
}
test();
测试结果是先弹窗undefined,后弹窗bbb