<script> const stringSumNumber = value => { do { value = [...String(value)].reduce((p, c) => p + (/\d/.test(c) ? Number(c) : 0), 0) } while (value > 9) return value } alert(stringSumNumber('10.10.1991')) </script>