jquery - JavaScript trim character -


i want delete "()" each value. how that?

var arr = ["(one)","(two)","(three)","(four)","(five)"];  for(var = 0; < arr.length; i++){   console.log(arr[i]); } 

since other answers unnecessarily complicated, here's simple one:

arr = arr.map(s => s.slice(1, -1)); 

you can in-place if prefer; important part .slice(1, -1), takes substring starting character @ index 1 (the second character) , ending before last character (-1).

string.prototype.slice documentation on mdn


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -