配列をプッシュする機能がありますが、常に条件が一緒にチェックされているため、問題が発生しています。これとは別に、中括弧を使用すると、配列番号が作成されます。の回。ここで適切に説明できなくても、pls は私のコードを見てください:
$.map(pObj,function(values,i){
if(typeof pieArray[values.GeoID] == 'undefined')
pieArray[values.GeoID] = []; //it should create only one time
pieArray[values.GeoID].push(values.ResponsePercentage); // when it matches it should not go down to check next if. else it can go.
if(!values.GeoID && typeof pieArray[0] == 'undefined')
pieArray[0] = []; //it should create only one time
pieArray[0].push(values.ResponsePercentage); //now the top if get response, till it is checking and throwing error. top if not match, then it need to work.
});
どうすればこれを達成できますか?