Check in the function, the console output result should be before the return result,
[1] The console output result should be before the return return result
[2] After the return, check that the console output is undefined
Example: ItemCount.prototype.get_count = function(good ){
var item_count=_.countBy(this.inputs,function(barcode){
return barcode.split('-')? barcode:barcode.split('-');
});
for(good in item_count){
if (_.indexOf(good,'-')!=-1){
item_count[good.split('-')[0]]=good.split('-')[1];
item_count[good]=undefined ;
}
}
[1] console.log(item_count)==> output normal return result
return item_count;===> return {"ITEM000001":5,"ITEM000005":3,"ITEM000003":"2" }
【2】console.log(item_count)==>输出undefined
}
Code inspection notes
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326942072&siteId=291194637
Ranking