question

Hsw avatar image
Hsw asked

Problem with parseInt coming back as NaN

Hi, I am working to develop an application for Alexa in Java. I'm developing a skill where the user tells alexa a number (a weight in grams), she manipulates the number to give it in cups, and then she returns the gram and cup measurements. I have coded the input as AMAZON.NUMBER and am then using parseInt to extract the integer, which I am manipulating and returning. I was having a lot of problems getting parseInt to return something that wasn't NaN. Yesterday, I changed the code a little bit and it worked, and I got back the correct number and answers. I saved the code, tested it on my amazon echo later, and it still worked. About an hour after that, I tested it on my echo again and got a NaN error. I tried a few more times and still got NaN. I checked my Alexa app to make sure I was saying the exact same phrase, and I was. I went back to test on the developer site and I was getting the error there as well-- even though I hadn't been getting it a few hours prior. There was no change in the code in the meantime. Please advise me on what to do. You can view my code here https://github.com/hsw28/alexa/tree/master/metriccooking but I think it may be the result of a problem external to me since the ouput changed with no change in the code or the inquiry. Thanks, Hannah
alexa skills kitvoice-user interface
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Hsw avatar image
Hsw answered
Figured it out! Was parsing the word grams and an integer
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.