Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


The sum function () method will get calculate the numeric sum of an array values. Array values that are not numeric are treated as if they were zeros.

Return Value

Value returns a sum of parent array.

Error Handling

If you try and sum an array which is not numeric values, the function will crashSum as a numeric value.

Example
Code Block
languagejavascript
pjs.define("Num", { type: 'integer', length: 10, dim: 5 });
 
Num[1] = 1;
Num[2] = 2;
Num[3] = 3;
Num[4] = 4;
Num[5] = 5;
 
return Num.sum();
//15

...