<!DOCTYPE html>
<html>
  <head>
    <script>
      window.onload = function(){
        var items = new Array('apple','orange','cherry','lime');
        var sep = '*';
        concatenateString(items,sep);
        alert(items);
        alert(sep);
      }
      
      function concatenateString(strings,separator){
        var result = "";
        for(var i=0; i<strings.length; i++){
          result += strings[i] + separator;
        }
        
        //결과를 separator에 할당
        separator = result;
        
        //배열에도 할당
        strings[strings.length] = result;
      }
      
    </script>
  </head>

  <body>
    
  </body>

</html>