function init(){
var panel = document.getElementById("panel");
var i;
var week = ["monday","tuesday","wednesday","thursday","friday"];
var weekend = ["saturday","sunday"];
panel.innerHTML+="weekdays: "+ week;
panel.innerHTML+="<hr>weekend days: "+ weekend;
for(i=0; i<weekend.length; i++)
{
week[week.length]=weekend[i];
}
panel.innerHTML+="<hr>increased with weekend days: "+week;
week-=2;
panel.innerHTML+="<hr>reduced back to weekdays: "+week;
}
window.onload=init;
这是从另一个 html 文件加载的主要 js 代码。一切正常,直到最后。最后一个输出应该是“减少到工作日:星期一,星期二,星期三,星期四,星期五”,但我得到的是“减少到工作日:NaN”,这个错误是什么意思,我该如何解决?