Issue
I currently have an array in angular that I would like to change the structure of. Example array:
0: "Car 1"
1: "Car 2"
2: "Car 3"
3: "Car 4"
4: "Car 5"
5: "Car 6"
I would like to convert it to Car1,Car2,Car3,Car4,Car5 so that I can use the IndexOf() function for each comma.
Solution
let yourString = yourArray.map(e => e.replace(/\s/g, "")).join(",")
Answered By - Benoit Cuvelier
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.