/ Published in: ActionScript 3

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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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
Comments
