Having some issues getting my head around this. I am trying to use a function to split a variable into two and then add a html <span> tag around each character.
I have managed to do this process through a variable easy enough however when I try as a function it does not work.
<script>
var value = "30";
function myFunction(a) {
var a = a.split("", 2);
var a = "<span>" + a[0] + "</span><span>" a[1] + "</span>";
}
document.getElementById("demo").innerHTML = myFunction(value);</script>
Any hints as to why this might be?