IR Framework

Array.and Method

Identify values that are in both of two Arrays.
object.and (arr)

Arguments

object
Required. Always the name of an Array object.


arr
Required. The other array in the comparison.



Return Value

The Array.and method returns an array containing the values that are in both arrays.

Remarks

The following example illustrates the use of the Array.and method.

//	Let's create some arrays then compare them.
var a = new Array("a", "b", "c", "d", "b", "e", "d");
var a = new Array("c", "d", "e", "f", "d", "g", "e");
Console.Writeln(a.toString());        //    returns "a,b,b,d,b,e,d"
Console.Writeln(b.toString());        //    returns "c,d,e,f,d,g,e"
var x = a.and(b);                     //    find the values that are in both arrays
var y = a.or(b);                      //    find the values that are in either array
var z = a.xor(b);                     //    find the values that are in one array or the other, but not both
Console.Writeln(x.toString());        //    returns "c,d,e"
Console.Writeln(y.toString());        //    returns "a,b,c,d,e,f,g"
Console.Writeln(z.toString());        //    returns "a,b,f,g"



Requirements

Array.contains(), Array.unique()