I want my splitFunction to do something like this:
splitArray(‘AAABBBCCCDDDAAA’) => [‘AAA’, ‘BBB’, ‘CCC’, ‘DDD’, ‘AAA’]
could I do something like this:
function splitArray(string){
return string.match(/<br />&#?[a-zA-Z0-9]+;/g).split(’’)}
I want my splitFunction to do something like this:
splitArray(‘AAABBBCCCDDDAAA’) => [‘AAA’, ‘BBB’, ‘CCC’, ‘DDD’, ‘AAA’]
could I do something like this:
function splitArray(string){
return string.match(/<br />&#?[a-zA-Z0-9]+;/g).split(’’)}
match
returns an array, you can’t use split
on an array.
Or one or the other, but not both.
I personally think that match
would be easier to implement.