Product of Digits of Sum

Published by Mubashir Hassan in

Create a function that takes an array of numbers and adds them together to get a new number. The function then repeatedly multiplies the digits of the new number by each other, yielding a new number, until the product is only 1 digit long. Return the final product.

Examples

sumDigProd([16, 28]) ➞ 6
// 16 + 28 = 44
// 4 * 4 =  16
// 1 * 6 = 6

sumDigProd([0]) ➞ 0

sumDigProd([1, 2, 3, 4, 5, 6]) ➞ 2

Notes

The input of the function is at least one number.

Watch a quick demo on how Edabit works.