Я следую учебному пособию для Amazon Alexa SDK по адресу https://ask -sdk-for-nodejs.readthedocs.io / en / latest / Developing-Your-First-Skill.html
Включает пример кода, который определяет объект двумя методами.
const LaunchRequestHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'LaunchRequest';
},
handle(handlerInput) {
const speechText = 'Welcome to the Alexa Skills Kit, you can say hello!';
return handlerInput.responseBuilder
.speak(speechText)
.reprompt(speechText)
.withSimpleCard('Hello World', speechText)
.getResponse();
}
};
Я ожидал, что методы будут определены в форме:
const LaunchRequestHandler = {
canHandle: function(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'LaunchRequest';
},
//etc...
}
Почему пример кода из учебника работает?