How to split into a group of characters?

I want to split the string

"abcdefgh"

to

"ab","cd","ef","gh"

using javascript split ()

"abcdefgh".split(???)

Can you help?

+5
source share
1 answer

Instead splittry match:

var text = "abcdefgh";
print(text.match(/../g));

prints:

ab,cd,ef,gh

as you can see on Ideone .

+11
source

All Articles