dimanche 26 février 2017

If/Else Statement Not Evaluating

I have a little helper function that is not evaluating on either the If or Else.

I know the function is being called because I have the nlapiLogExecution, which is how you debug in NetSuite. Notes on what is being logged are with the code.

How is this possible? I have tried to use == operator as well. I also tried to set it as a variable inside the function (which I don't think is necessary).

function convertUnit(unit, cubicMeters){
    nlapiLogExecution('DEBUG','convertUnitFunction',typeof(unit))
    // typeof is String
    nlapiLogExecution('DEBUG','convertUnitFunction',unit)
    // value is Each
    if (unit === 'Each'){
        return cubicMeters
        nlapiLogExecution('DEBUG','equals Each', cubicMeters)
        // does not log here
    }
    else {
        nlapiLogExecution('DEBUG','else statements', 'equals else')
        // Does not log here
    }
}

Aucun commentaire:

Enregistrer un commentaire