How to format a number

I have made a function that scans a barcode which gives the result that is a 12 digit number.
Now I need to make that number formatted in a way that has 2 digits then a colon, 2 digits and a colon. etc. Almost like the time format, but with 6 sets of 2 digit numbers.
Is there a way to format that string of numbers in that way?

To Clarify, the number is a mac address, so it is letters and numbers.
I want to change “A1B2C3…” to “A1:B2:C3…”

It turns out that the colons in the mac address are inconsequential (I tested without them and it worked), so no need to change format to include them.

Just in case, you can use JavaScript .match() on the string and parse it at every nth character.

You can try this:

let str = “A1B2C3D4E5F6”;
let result = str.match(/\w{2}/g).join(’:’);