Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Why you think it should give correct answer? You don't need '+=' or '='. You don't need to change 'result' inside reduce at all. reduce already assigns its returned value to a 'result' parameter after each cycle. Just return 'result + Math.pow( parseInt(value ,10)'.
Besides this your code has some other useless operations.
You can use a "reduce" method every time you need a single value derived from all array elements. Just that simple.
Nice :D
No need to convert string to array. for...of loop can iterate over strings too. 👍
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
wealth = wealth.fill() is unnecessary, because wealth.fill() already modifies original array.
This comment is hidden because it contains spoiler information about the solution
They are not the same. "value" variable is still an integer that was passed to a function. It wasn't changed. "arr" variable is an array of digits (as strings) that was created after you applied .toString() and .split() methods to "value".
"value" is a number type. Numbers do not have length property.
Hope this helps :)