Arrays
Array.reduce()
Learn how to use Array.reduce() in JavaScript.
Array.reduce()
Documentation for Array.reduce() in JavaScript.
Syntax
arr.reduce((acc, x) => acc + x, 0)
Example
// Practical usage
arr.reduce((acc, x) => acc + x, 0)
console.log("Executed successfully.");
Notes
JavaScript provides powerful built-in methods for the web.
Try It Yourself
You can run JavaScript directly in the BrowserCode Playground.