javascript slice string every 3 characters code example
Example 1: split every n character js
var str = 'abcdefghijkl';
console.log(str.match(/.{1,3}/g));
Example 2: split a string every n characters javascript
console.log("abcd".match(/.{1,2}/g)); // ["ab", "cd"]