欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

actionscript

程序员文章站 2022-03-15 20:17:50
...
 var a:int = 5;
var b:uint = 5;
trace(a==b);
trace(a===b);
b = 3;
trace(a<b);
trace(a>=0&&a<=10);

trace(typeof 10);
trace(typeof true);
trace(typeof Object);
trace(typeof [1,2,3]);

trace(9  is Number);
trace([1,2]  is Number);
trace([1,2]  is Array);

trace(9 as Number);
trace(9 as Array);

var arrs:Array = ["a","b","c"];
trace(2 in arrs);
trace(3 in arrs);

var aObject:Object = {age:10};
trace("age" in aObject);

var bObject:Object = {"status":"ok"};
delete bObject.status;
trace(bObject.status);



结果

true
true
false
true
number
boolean
object
object
true
false
true
9
null
true
false
true
undefined

 

 var a:Object={"name":"sanco","age":25,"weight":50};
 for(var k in a){
		trace("Key:\t"+k+"\tValue:\t"+a[k]);
	 }
	 
	 for each(var j in a){
		 trace("Key:\t"+j+"\tValue:\t"+a[j]);
		 }

 

 结果

Key: weight Value: 50
Key: name Value: sanco
Key: age Value: 25
Key: 50 Value: undefined
Key: sanco Value: undefined
Key: 25 Value: undefined