【发布时间】:2018-04-26 17:30:40
【问题描述】:
我正在学习 Alexa 和 AWS Lambda,并试图确定为什么当将 AMAZON.NUMBER 类型的插槽添加到另一个数字(在我的情况下是属性)时,这些数字直接在一起,就好像它们被串联而不是比添加?
'CountSeveralTimes': function(){
var count = this.event.request.intent.slots.count.value;
this.attributes['currentCount'] = this.attributes['currentCount'] + count;
this.response.speak("Nice Job! You have now counted " +
this.attributes['currentCount']+ " times.").listen();
this.emit(':responseReady');
},
假设我运行了上面的代码,“count”的值是插槽类型 AMAZON.NUMBER,为 10,currentCount 为 10。它不是将 10 + 10 相加为 20,而是而是返回“干得好!你现在数了 1010 次。”我尝试通过在它们的添加之间放置一个随机数来进行调试,以查看哪个添加不正确。属性 (currentCount) 可以正确添加,但插槽中的 count 变量没有。
任何帮助将不胜感激。
【问题讨论】:
标签: node.js amazon-web-services aws-lambda alexa