Making a sum with lodash _.sum, _.reduce, and vanilla javaScript alternatives
Creating a sum from an array, more often then not, is a fairly trivial matter with javaScript as it can quickly be done with a native array method like reduce. However in some cases it might be nice to have methods that make quick work of trivial tasks such as this by allowing me to just call a single method for this and move forward with a project that much faster.
Making a native sum method might not be so hard, however if lodash is there to work with in a project then that can be called to quickly create a sum for an array of numbers. In this post I will be writing about _.sum, _.sumBy, _.reduce when it comes to working in a project in which lodash is there to work with. However because lodash seems to be on its way out there is also looking into vanilla js alternatives when creating a sum from an array of numbers.