I need to return several variables depending on the input code. For instance, if the code is A, I return a specific set of values; if it’s B, I return another set; and if neither is entered, I should provide a default response. Below is my current implementation:
if (inputData.code === 'WSDCD-D2DUK') {
outputVar = 'Company A';
} else if (inputData.code === '6P1CX-5U2TY') {
outputVar = 'Company B';
} else {
outputVar = 'Not Available';
}
return {result: outputVar};
What I need is a structure similar to this:
if (inputData.code === 'WSDCD-D2DUK') {
outputVar = 'Company A';
courseVar = 'ABC';
} else if (inputData.code === '6P1CX-5U2TY') {
outputVar = 'Company B';
courseVar = 'XYZ';
} else {
outputVar = 'Not Available';
courseVar = 'Not in one';
}
return {result: outputVar, course: courseVar};