Use exponent ** operator over Math.pow

This commit is contained in:
atomiks
2018-01-01 04:40:03 +11:00
parent 7edaae36a1
commit acbb3903fa
2 changed files with 2 additions and 4 deletions

View File

@ -6,7 +6,7 @@ Convert the given number into an array of digits. Use `Math.pow()` to get the ap
```js
const isArmstrongNumber = digits =>
(arr => arr.reduce((a, d) => a + Math.pow(parseInt(d), arr.length), 0) == digits)(
(arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)(
(digits + '').split('')
);
```