I have the following string:
var group = "one+two+three";
Each value in the string is separated by a +
, and I wanted to add them separately in an array, so It could then become:
var group_array = ["one", "two", "three"];
How can I do this?
I have the following string:
var group = "one+two+three";
Each value in the string is separated by a +
, and I wanted to add them separately in an array, so It could then become:
var group_array = ["one", "two", "three"];
How can I do this?
You can simply split()
it:
var groupArray = "one+two+three".split("+");
// -> will give you ["one", "two", "three"];