Javascript String Join(array, separator)

Description

Javascript String Join(array, separator)


String.Join = function (array, separator){
 var result = "";
  
  array.forEach(function (i) {
   if (result !== "")
     result += separator;//from w  ww. j  a v  a 2  s .co  m
      
  result += i;
  });
  
  return result;
}



PreviousNext

Related