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

as3

程序员文章站 2022-03-15 20:18:26
...

 

/* var card:Array=["红桃A","方块7","黑桃Q","梅花3","梅花10","黑桃6","黑桃J"];
 trace(card.sort(cheat));
 function cheat(a,b){
	 
	if(a=="红桃A")
	 return 1;
	 else 
	return Math.random()>0.5?1:-1;
}*/

/* var player1:Object={"name":"sanco","age":6,"gender":undefined};
 var player2:Object={"name":"s12anco","age":26,"gender":"male"};
 var player3:Object={"name":"sanweco","age":46,"gender":"female"};
 var player4:Object={"name":"wesanco","age":2,"gender":undefined};
 var objarr:Array=[player1,player2,player3,player4];
 objarr.sortOn("age",Array.NUMERIC);
 for(var i:uint=0;i<objarr.length;i++){
	 
	 trace(objarr[i].age);
	 
	 }*/
//	 var card:Array=["红桃A","方块7","黑桃Q","梅花3","梅花10","黑桃6","黑桃J"];
//	 var a:Array=[0,1,2,3,4,5,6,7,8,9];
//	 a.splice(1,3,card);
//	trace(a.toString());
//	var str:String=a.join("|");
//trace(str);

/*var str:String="dsnbsj56hjgj43jhjhkhkj6hk4h34343hjkh";
trace(str.split(/\d+/g));
trace(str.indexOf("bs"));
	
	 var a:Array=["d","saa",4,43,"w"];
	 
	 trace(a.lastIndexOf("saa",2));*/
	 
	/* var a:Array=[1,2,4,8,16,32,614];
	 trace(a.some(isDouble));
	  trace(a.every(isDouble));
function isDouble(element,index,array){
	if(index<array.length-1){
		
		return element*2==array[index+1];
		
		}else{
			return true;
			}
	
	}*/
	
	var a:Array=["春",1,"夏",2,"秋",3,"冬",4];
	var aFilter:Array=a.filter(onlyString);
	  function onlyString(element,index,array){
	 	return element is String;
	}
	trace(aFilter);
	

上一篇: 致橡树

下一篇: as3