面试题
var num = 12; window.setTimeout(function(){ num += 100; console.log(num); },1000); console.log(num); var num = 12; window.setTimeout(function(){ num = 100; console.log(num); },1000); while(1){ console.log(num); }
var total = 0;
function sum(n){
if(n == 0){
return;
}
total += n;
sum(--n);
}
sum(10);
console.log(total); // 12、112 // 12死循环
// 获取1到10的和
居敬持志~ Coding