[JavaScript]Re-declaring variable

今天注意到JavaScript里的一个特性:一个变量被重新声明后,其之前的赋值还是存在的

var test ="test";
console.debug(test) ;//output: test
var test;
console.debug(test);// also output: test

 

posted @ 2012-12-12 06:16  卜海清  阅读(132)  评论(0编辑  收藏  举报