문제

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;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top