-2
こんにちは、私のlogs.dateはログの実際の日付を出力しますが、それを という新しい配列にプッシュすると、配列の各インデックスにNanが渡されます。 forEachループとindexOf関数を使用して初めてのことです。皆さん、何が間違っているのを見ますか?それはあなたのNaN
値を与えるインクリメントundefined
あるNaNエラーの値をチェックする方法
theLogs.forEach(function(logs){
//if this line gets you 0 or higher it found it at that index, if you get -1 it was not found.
var index = dates.indexOf (logs.date);
if (index > -1){
//it was found so increment
dates[index]++;
}
else {
//it was not found so add a new entry in dates
dates.push(logs.date);
counters[counter] = 1;
}
});
'dates'変数のインスタンスをどのように表示することができますか? –
ログは何ですか?.. – amanuel2
クリスウォルシュ私はちょうど彼のvar dates = []; –