Attempted to create the following JavaScript for UPC Check Digit Validation using SAP Screen Personas 2.0 and couldn't get it to work. It looks like the system didn't like the coding. I am hoping someone could take a look at this code and let me know what's wrong with this code. Any help provided would be greatly appreciate it. Thanks!

var evens=0;
var odds=0;
var remainder=0;
// walk through each character except the last in the var args.bottleupc
for (i=0,i<args.bottleupc.length-1;i++)
{
// add the odd and even numbers
if ((i % 2) == 1)
odds = odds + parseInt(args.bottleupc.substr(i,1));
else
evens = evens + parseInt(args.bottleupc.substr(i,1));
}
evens = evens * 3;
// get the remainder if not evenly divisible by 10
remainder=(evens+odds) % 10;
// compare the remainder to the last digit in args.bottleupc
if (remainder != parseInt(args.bottleupc.substr(args.bottleupc.length-1,1))
{
args.msg = "BAD CHECK DIGIT";
}

## Add comment