I have a string like
var str = "aabbrdfc0912";
and i want to convert it in an array in pair of two like
var arr = ["aa","bb","rd","fc","09","12"];
Please suggest.
You could use a regular expression for it.
var str = "aabbrdfc0912",
array = str.match(/..|./g);
console.log(array);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With