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
).
Comments
Post a Comment