For example var str = 2975; you need to multiply the first by the second 2*9 .
Update
For some reason, I can't sum up if you write it like this.
var morth = 10; var date = 16; var morth1 = (morth).toString(); var date1 = (date).toString(); // Складываем цифры дня и месяца рождения var date_res = date1[0] + date1[1]; var morth_res = morth1[0] + morth1[1]; var resultat = date_res + morth_res; document.write(resultat);
+operator not only adds numbers, but also concatenates strings, which is done primarily for strings. UseparseInt()to convert strings to integers. - etki