Q:

Java script number format change

I've number i.e. 12345678 and I want to change it to the following format
[12,34,56,78]. How can I do that?

A:

You can use match

var str = '12345678';
console.log(str.match(/.{1,2}/g).map(Number));

