As the title says, I’ve got a string and I want to split into segments of n characters.

For example:

var str="abcdefghijkl";

after some magic with n=3, it will become

var arr = ['abc','def','ghi','jkl'];

Is there a way to do this?

16 Answers
16

Leave a Reply

Your email address will not be published. Required fields are marked *