# Detecting var output "NaN"

**URL:** <https://forum.kirupa.com/t/detecting-var-output-nan/115403>\
**Category:** Uncategorized\
**Created:** [July 8, 2004, 7:21am UTC](https://forum.kirupa.com/t/detecting-var-output-nan/115403 "2004-07-08T07:21:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![swammerdami](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@swammerdami](https://forum.kirupa.com/u/swammerdami)\
**Post date:** [July 8, 2004, 7:21am UTC](https://forum.kirupa.com/t/detecting-var-output-nan/115403/1 "2004-07-08T07:21:45Z")

</div>

I need to be able to detect if the input a user types into an Input text field is not a number (NaN). I thought this would be a breeze, but I am having trouble. First I created a function that sets a new variable equal to the input value multiplied by 1.

```auto
 valuetest = value*1;

```

For testing purposes I placed a temp text box on the stage (var: valuetest). Sure enough, when the function is called and if value contains anything but numbers, valuetest becomes NaN. Then later on the timeline I check what valuetest is.

```auto
 if (valuetest == "NaN") {
 	gotoAndPlay("error"); }

```

Does not do what it supposed to. I tried doing this several ways, including putting all the code into the function, but I can not get it to “see” the NaN as a variable. I replaced the “NaN” in the if statement with a number and it works when I input that number… so I suspect that the code is correct and the problem has to be something to do with how Flash deals with a NaN output. ???  
I really could use some help on this, if anyone is willing.  
Thanks!
