var isHappy = function(n) {
if (n === 1) return true
else if (n != 1 && n < 10) return false
else {
const array = Array.from(`${n}`);
const output = array.map(num =>num * num).reduce((acc, curr) => acc + curr);
isHappy(output);
}
};
console.log(isHappy(19))