If you have a simple line:
var a = '23452144'; alert(a.substring(0,4) + '/' + a.substring(4,6) + '/' + a.substring(6));
For the number you can use
var s = a.toString();
For a long string with many such dates, this will replace their formats (you can easily play with it if you want, for example, the dd / mm / yyyy format):
a.replace(/\b(\d{4})(\d{2})(\d{2})\b/g, "$1/$2/$3")
source share