Alexa的Javascript字典

Alexa的Javascript字典,javascript,dictionary,aws-lambda,alexa,alexa-skills-kit,Javascript,Dictionary,Aws Lambda,Alexa,Alexa Skills Kit,我正在使用javascript(特别是Node.js)构建Alexa技能,但遇到了一个我不理解的错误。首先,守则: "use strict"; var Alexa = require("alexa-sdk"); var handlers = { "LaunchRequest": function () { this.response.speak(content[one]).listen(content[oneNext]); this.emit(':responseRea

我正在使用javascript(特别是Node.js)构建Alexa技能,但遇到了一个我不理解的错误。首先,守则:

"use strict";

var Alexa = require("alexa-sdk");

var handlers = {
  "LaunchRequest": function () {
    this.response.speak(content[one]).listen(content[oneNext]); 
    this.emit(':responseReady');
  },
  "TwoIntent": function() {
    this.response.speak(content[two]).listen(content[twoNext]); 
    this.emit(':responseReady');
  }
};

var content = {

      one: 'text',
      oneNext: 'text',
      two:'text',
      twoNext: 'text',
      three: 'text',
      threeNext: 'text',
      four: 'text',
      fourNext: 'text',
      five: 'text',

    };

// Stock Alexa Handlers & Functions

exports.handler = function(event, context, callback){
  var alexa = Alexa.handler(event, context);
    alexa.registerHandlers(handlers);
    alexa.execute();
};
我在Lambda接口中遇到的错误是:“一个未定义。请修复或添加/global one/”


根据我能找到的关于如何使用javascript编写字典的所有文档,这种语法是正确的。这是alexa或lambda特有的吗?

不要使用
内容[one]
使用
内容。one
内容。onext
内容。two
内容。twoNext
。或者可能
内容[“一”]
。。。这是另一种语法。

基本上,如果您执行了
var one=“one”那么代码的这一部分就可以工作了。JS运行时正在查找名为
one
的变量,而不是使用字符串
“one”