AS3检查两个不同数组中的所有值是否相同
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AS3检查两个不同数组中的所有值是否相同相关的知识,希望对你有一定的参考价值。
I'm not sure whether I should be using == (Equality) or === (Strict equality) here. I haven't been able to create a situation where it makes much difference. If you know better, feel free to leave me a comment.
var array1:Array = new Array(1,2,3,4,5,6,7); var array2:Array = new Array(1,2,3,9,5,6,7); function checkIfArraysMatch($arrayA:Array, $arrayB:Array):Boolean { var isMatch:Boolean = true; if($arrayA.length == $arrayB.length) { for (var i:int = 0; i<$arrayA.length; i++) { if ($arrayA[i] != $arrayB[i]) { isMatch = false; break; } } } else { isMatch = false; } return isMatch; } trace(checkIfArraysMatch(array1, array2)); // OUTPUT: false
以上是关于AS3检查两个不同数组中的所有值是否相同的主要内容,如果未能解决你的问题,请参考以下文章