Javascript join(), i want to join some of them in array -
in case example, have array :
var myarr = ["red", "green", "blue", "yellow"];
question: how join "myarr", except "red" or 1 of them, or want join of them (example). example, becomes below: greenblueyellow advice..
you can use array.prototype.filter()
var filterval = 'green'; var joinedstring = myarr.filter(function(item){ return item !== filterval; }).join(); alert(joinedstring);
Comments
Post a Comment