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); 

demo


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -