开发者

Siebel eScript varargs function always throws an exception

开发者 https://www.devze.com 2023-01-09 10:46 出处:网络
according to Siebel documentation, eScript supports varargs. The following sample is taken from the Siebel documentation:

according to Siebel documentation, eScript supports varargs. The following sample is taken from the Siebel documentation:

function SumAll()
{开发者_运维问答
  var total = 0;
  for (var ssk = 0; ssk < SumAll.arguments.length; ssk++)
  {
    total += SumAll.arguments[ssk];
  }
  return total;
}

However, if I call this method like SumAll(1,2,3) I get the following exception:

TypeError: Can't convert 'Undefined' to Object. Service.SumAll line xxx

where xxx is the line number of the for statement.

Any idea, why? Thanks!


Instead of typing "SumAll.arguments", try using just "arguments" like this:

function SumAll()
{
  var total = 0;
  for (var ssk = 0; ssk < arguments.length; ssk++)
  {
    total += arguments[ssk];
  }
  return total;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消