Not a Number : Number : Data Type Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Data Type » Number »

 

Not a Number


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
         var n:Number;
         trace(n)//NaN
         trace(isNaN(n))//true
         trace(n == NaN)//false! That's why you use isNaN()
         n = Number("this won't convert into a number");
         trace(isNaN(n))//true
         n = 10;
         trace(isNaN(n))//false
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Data Type
» Number