FLASH中null、undefined、NaN、""这3个特殊的值是非常容易弄错的,不过大家可以从下面的语句中看出各自的区别:
var ddd0:String;
var ddd1:String = null;
var ddd2:String = undefined;
var ddd3:String = NaN;
var ddd4:String = "";
trace("ddd0="+ddd0);
//output:undefined
trace("ddd1="+ddd1);
//output:null
trace("ddd2="+ddd2);
//output:undefined
trace("ddd3="+ddd3);
//output:undefined
trace("ddd4="+ddd4);
//output:
var ddd5:String = "233.2";
trace("ddd0="+Number(ddd0));
//output:NaN
trace("ddd1="+Number(ddd1));
//output:NaN
trace("ddd2="+Number(ddd2));
//output:NaN
trace("ddd3="+Number(ddd3));
//output:NaN
trace("ddd4="+Number(ddd4));
//output:NaN
trace("ddd5="+Number(ddd5));
//output:233.2