JSFiddle - React, Tailwind, and code Playground

JavaScript

var num = "12345";
var str = num.replace(/(.)/g,'<span>$1</span>');
console.log(str);