Wednesday, 3 May 2017

How to perform foreach loop in same order in nodejs

I am getting the array from client side as

 var arr = [{'url':'www.google.com},{'url':'www.fb.com'}]

I want to assign it to a string as

var urls = www.google.com,www.facebook.com

Which I did but I am getting the index reverse like below

var urls = www.facebook.com,www.google.com

My code,

duis.arr(function(v,i){
   urls = v.url + ','+urls;
}

Can anyone please suggest help.Thanks.



via MMR

No comments:

Post a Comment