Add digits of a number using javascript