how to slice every 2 characters of a string in javascript 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"]