Functionality inside Reduce function!


#1

Hi there,

I’m trying to write a Reduce function that does some operations on the values retrieved from MAP function.
For this I need to loop through the values and add some characters in between the results, something like:

function (keys,values){
var ss=’[’;
while (values.next)
{
ss=ss+’,’+currentvalue;
}
ss=ss+’]’;
return ss;
}

but I don’t know how to loop through the results (I mean how to implement “values.next” and “currentvalue”).

I would really appreciate if you can help me here.

Many thanks.