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?
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?