Coding the Lambda function

We will be editing the code inline, in the index.js file in the developer portal itself:

  1. First of all, we shall define an array of JSON, which will contain the quiz questions to be posed by the trivia skill. This can be defined right at the top of the index.js file, even before the exports.handler:

//questions is an array of json objectsvar questions = [    {        "World War I began in which year?": [            "1923",            "1938",            "1917",            "1914"        ]    },    {        "Adolf Hitler was born in which country?": [            "France",            "Austria",            "Hungary",            "Germany"        ]    },    {        "The battle of Hastings was fought in which country?": [            "France",            "Russia",            "England",            "Norway"        ]    }];var correctAnswerSlots = [3, 1, 2];

As shown in the preceding code, apart from the questions ...

Get Alexa Skills Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.