First declare an array:
var key;
var value;
for (var i = 0; i <50; i ) {
//Get the key-value pairs to be added to the data dictionary
key= jQuery("#costCodeIdId" i).val();
Value = num2zero(jQuery("#valueId" i).val());
// Check whether the key value exists in the data dictionary. If it does not exist, directly add the key value and value to the data dictionary. If the key value exists, the value value is accumulated
if(checkHasInDict(key,dictNew)){
dictNew[key] = num2zero(dictNew[key]) value;
}else{
dictNew[key] = value;
}
}
//Value of data dictionary
function getDictValue(key,dict){
var tempDictValue = "";
for(var k in dict){
if(k==key){
tempDictValue =dict[k];
return tempDictValue;
}
}
return tempDictValue;
}
//Check whether the key value exists in the array
function checkHasInDict(key,dict){
for(var k in dict){
if (k == key){
Return true;
}
}
return false ;
}