#How do I get numbers in an array in a for loop to print the sum?

4 messages · Page 1 of 1 (latest)

true fiber
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

crystal horizon
#

This question pertains to arr2 where I need to make the sum print.

swift dew
#

This isnt discord.js related at all, what you want is reduce

alpine kilnBOT
#

mdn Array.prototype.reduce()
The reduce() method executes a user-supplied "reducer" callback function on each element of the array, in order, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the array is a single value.