Function sum returns summation of all numbers passed as standalone arguments
Remarks
The sum function is mathematically defined as the addition of sequence of any kind of numbers
and in practise is used very often.
Usage of the function is heavily inspired by ECMAScript's native Math module functions,
like Math.min
and Math.max.
Therefore it takes optional amount of numerical arguments passed
and tries to efficiently proceed with computation of summation. Be aware that passing any
non-numerical argument may cause unexpected results, as JS "plus" operator works as both -
addition operator as well as string concatenation operator with virtually any type of variables.
Example
Simple usage of direct use of values or variables:
Function sum returns summation of all numbers passed as standalone arguments
Remarks
The sum function is mathematically defined as the addition of sequence of any kind of numbers and in practise is used very often.
Usage of the function is heavily inspired by ECMAScript's native Math module functions, like Math.min and Math.max. Therefore it takes optional amount of numerical arguments passed and tries to efficiently proceed with computation of summation. Be aware that passing any non-numerical argument may cause unexpected results, as JS "plus" operator works as both - addition operator as well as string concatenation operator with virtually any type of variables.
Example
Simple usage of direct use of values or variables:
Usage with already existing array of values: