Friday, 12 May 2017

for each in node js not getting result?

This is my code:

 var array=[];
    var shopId =[1,2,3,4];                    
    for(var i in shopId){
      function(result){
        ---------------
        --------------
        array.push(result);
        console.log(array);//result have values
      }
    }
    console.log(array);//result empty

The final console have array with empty value.Please help me to sort out this problem..



via midhun k

No comments:

Post a Comment