Summing Numbers in Arrays (JavaScript Journey)

I was checking out some challenges on Hackerrank, Which was summing the total number in an array, I later discovered in ES6 (ECMAScript6) a lesser way to solve this problem.

Initially in ES3 (ECMAScript3) we sum the array numbers by using the reduce method, which reduces the array to a single value and then defining a new function to sum up the values in the array like this,

But now we have a simple way to solve that, no old school defined functions for reduce method ,you can simply just write it like this

simple and easy, you can get the source code on

I shall continue to learn and share my discoveries as my JavaScript quest stays alive.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.