Write Number in Expanded Form
const expandedForm = num => {
let pow = []
let decimal = []
num = num.toString().split('')
let len = num.length
for(let i = 0; i <= len - 1; i++){
pow.unshift(i)
}
num.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))
Also in JavaScript:
- javascript es6 dom manipulation
- how to find remainder in javascript
- get current month of year in number javascript
- class inheritance method javascript
- how to change package name in react native
- toggle class javascript stack overflow
- quill js server side delta
- group all items with same name js
- pagination.js
- jest
- how to get utc time in angular
- what is react native
- output event angular
- delete session javascript
- javascript map
- remove array element in javascript
- utiliser les données passees a un modal dans son propre composant en angular
- foreach async typescript
- google maps js on map load
- react native add custom fonts
- mock sqs.sendMessage node js
- three.js create sphere
- object literal javascript
- delete with unlinksync node