Jump to: navigation, search

JQuery Array to string with join

From w3cyberlearnings

Contents

jQuery Create String From Array

Uses join() function to join array elements into string.

Syntax $.join()

  • myFruits is the array to be joined
  • join_ch is the character or string uses to join the array's elements
 
myFruits.join(join_ch);

Example TRY-IT

$(document).ready(function() {
	var myList =[1,5,6,23,53];		
        myList = myList.join('-');
        alert(myList);
});

Output

1-5-6-23-53

Related Links


Navigation
Web
SQL
MISC
References