hey, any help would be great

function goodPPS(PPSNum)
{ //set valid to true
var valid = new Boolean(true);
//check length of PPS number is 8. if not Valid gets FALSE
! if(PPSNum.length != 8)
! ! {
! valid = false;
! ! }
//verify 1st 7 characters entered are digits
for(num = 0; num < 7; num++)
! {
! var number = PPSNum.slice(num, num + 1);
(a)
! }
//getting the letter of the PPS number and convert it into a number
! PPSNum = PPSNum.toUpperCase();
(b)
! letter = letter - 64;
//calculate sum by multiplying each digit by its weighting
! var sum = 0;
! for (var i = 0; i < 7; i++)
! ! {
! var digit = PPSNum.charCodeAt(i));
(c)
! ! }
//if letter is w then set it to 0, this is to deal if the last character is a w
if(letter == 23)
{
letter = 0;
}
//THE TEST - if the first 7 digits mod 23 not equal to the letter value
if (sum % 23 != letter)
! {
! valid = false;
! }
return valid;
}