Posted By

cobra90nj on 05/04/09


Tagged

javascript array String to


Versions (?)

Array to String


 / Published in: JavaScript
 

  1. //coded by cobra90nj
  2.  
  3. var str = "";
  4.  
  5. var arrname = new Array(5);
  6. arrname[0] = "Hi, ";
  7. arrname[1] = "this ";
  8. arrname[2] = "is ";
  9. arrname[3] = "an ";
  10. arrname[4] = "example.";
  11.  
  12. function arrtostr(arry)
  13. {
  14. for (var n in arry) {
  15. str += arry[n];
  16. }
  17.  
  18. return str;
  19. }
  20.  
  21. alert(this.arrtostr(arrname));

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: duniyadnd on May 5, 2009

You could just use join(). e.g. alert(arrname.join(''));

You need to login to post a comment.