javascriptdynamics-crmdynamics-crm-365-v9

Expected '(' when testing js in console


The following is my javascript and receiving an

Expected '(' error

in console.

//GLOBALS
var _debug = false;
//

function tryParseInt(accountNumber) {

    if (_debug) { 
        console.log("Entering tryParseInt: " + new Date().toTimeString()); 
    }

    try{
        //var retValue = defaultValue;
        if(accountNumber !== null) {
            if(accountNumber.length > 0) {
                if (!isNaN(accountNumber)) {
                    //retValue = parseInt(accountNumber);
                    return true;
                }
            }   
        }
        return false;
    }
    catch{
        console.log("Failed at tryParseInt:");
        console.log(err);
        console.log("---------------------------------");
    }
}

I can't for the life of me figure why. Any extra eye will help.


Solution

  • this should be

    catch (error) {
    }