var n = 5678; sum = n % 9 || 9; console.log(sum)