所以我遇到了一个未定义的数组元素的问题。1)无法让我的未定义数组工作 2)我希望它输出数组作为单词和次数的出现。
var wordCount =[];
splitAT.sort();
alert(splitAT);
for (var i = 0; i < splitAT.length; i++)
{
if(splitAT[i] in wordCount)
{
wordCount.push(1);
}
else
{
wordCount[splitAT[i]] = 1;
}
document.write('[' + splitAT[i] + '][' + wordCount[i] + ']<br>')
alert("your next wordcount is");
alert(wordCount); // this is just so i know where i am in the program.
alert("END");