Número de gravação em forma expandida

// You will be given a number and you will need to return it as a string in Expanded Form. For example:

/* 
	// expandedForm(12); // Should return '10 + 2'
	// expandedForm(42); // Should return '40 + 2'
	// expandedForm(70304); // Should return '70000 + 300 + 4'
*/

const expandedForm = arr => {
    let pow = []
    let decimal = []
    arr = arr.toString().split('')
    let len = arr.length
    for(let i = 0; i <= len - 1; i++){
        pow.unshift(i)
    }
    arr.forEach((x,index) => {
        x = parseInt(x)
        decimal.push(x*10**pow[index])
    })
    let toDecimal = decimal.filter(a => a !== 0)
    return toDecimal.toString().split(',').join(' + ')
};
console.log(expandedForm(70304))

// With love @kouqhar
kouqhar