An important difference between the Interactive Reporting Studio scripting DOM and the Impact Management Services DOM is that all collections are zero-based, not one-based. For example, a loop that would have been coded as:
for (var i = 1; i <= collection.Count; i++) // some processing on collection[i]
is now written as:
for (var i = 0; i < collection.length; i++) // some processing on collection[i]