if (slotValues.listableThings.ERstatus === 'ER_SUCCESS_MATCH') {
switch (slotValues.listableThings.resolved) {
case 'CLASSES':
{
lookupArray = sessionAttributes.CLASSES;
};
break;
case 'TONES':
{
lookupArray = sessionAttributes.TONES;
};
break;
default:
break;
}
Is there a way to do this instead of using a switch to just set lookupArray = sessionAttributes.(slotValues.listableThings.resolved)
everything I can find on javascript says to use alert but alert is not defined in node.js for alexa skills.
You can iterate thought the elements and use the key to assign
// Emulating
var slotValues = {
listableThings: {
resolved: "CLASSES"
}
};
var sessionAttributes = {
CLASSES: "THESE ARE CLASSES",
TONES: "THESE ARE TONES"
}
let lookupArray = sessionAttributes[slotValues.listableThings.resolved];
console.log(lookupArray);