Apr 18, 2002 #1 Greenster Programmer Jan 14, 2002 30 GB In PHP you can turn an array into a string using implode() is there a similar function is javascript? Thanx {Greenster}
In PHP you can turn an array into a string using implode() is there a similar function is javascript? Thanx {Greenster}
Apr 18, 2002 #2 xutopia Programmer Apr 4, 2002 2,001 CA yes and it is called join() var myWords = ["Here", "is", "how", "it", "works."]; var mySentence = myWords.join(" " alert(mySentence) Hope this helps. Gary http://www.xutopia.com Haran Upvote 0 Downvote
yes and it is called join() var myWords = ["Here", "is", "how", "it", "works."]; var mySentence = myWords.join(" " alert(mySentence) Hope this helps. Gary http://www.xutopia.com Haran
Apr 18, 2002 #3 bvallet Programmer Apr 10, 2001 52 US Try: var string = array.join(separator); or var string = array.join(); separator is a variable containing whatever delimiter you want to use, or an empty string is used if it is left out. Upvote 0 Downvote
Try: var string = array.join(separator); or var string = array.join(); separator is a variable containing whatever delimiter you want to use, or an empty string is used if it is left out.
Apr 18, 2002 Thread starter #4 Greenster Programmer Jan 14, 2002 30 GB Thanks very much - that has helped me. Cheers {Greenster} Upvote 0 Downvote
Apr 18, 2002 #5 xutopia Programmer Apr 4, 2002 2,001 CA glad it helped. by the way if you have an array and you alert the array you will get it in a string format seperated by comas. Try : var myWords = ["Here", "is", "how", "it", "works."]; alert(myWords) Gary http://www.xutopia.com Haran Upvote 0 Downvote
glad it helped. by the way if you have an array and you alert the array you will get it in a string format seperated by comas. Try : var myWords = ["Here", "is", "how", "it", "works."]; alert(myWords) Gary http://www.xutopia.com Haran