From the course: Learning to Build Alexa Skills

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Create the subtract handler

Create the subtract handler - Amazon Web Services (AWS) Tutorial

From the course: Learning to Build Alexa Skills

Start my 1-month free trial

Create the subtract handler

- [Instructor] In the last video we created the addition intent handler, and now we're going to create the subtraction intent handler. So, what will be easy for us is if we copy and paste the code from the addition intent handler, and we can select from line 28 down to line 62. And we can Copy that code, and Paste that below. And we just need to make a few tweaks to this new object. So, instead of Add, we're going to change this to Subtract, for the SubtractIntentHandler. And the next change that we have to make in the canHandle function, we are going to change AddIntent to SubtractIntent, because that is the name of the Intent that we specified when we did the configuration of our Alexa Skill. Moving on, when we calculate the result, we also have to make a slight change. We actually need to flip the order of these variables. So it's going to be parseInt secondNumber, and replace this with minus parseInt firstNumber.…

Contents