Array.sum MethodSums the values in an array.object.sum () Arguments
Return ValueThe Array.sum method returns a number or string containing the sum of the array's elements' values.In the case of a string array, the values are concatenated in order. If the values in the array are not all of the same type, or if they are not numbers or strings, the return value is undefined. RemarksThe following example illustrates the use of the Array.sum method.var a = new Array("He", "ll", "o", ", Wo", "rld", "!"); Console.Writeln(a.sum()); // returns "Hello, World!" var b = new Array(1, 4, 6, 2, 4); Console.Writeln(b.sum().toString()); // returns "17" Requirements |