This function compares two arrays, returning true or false depending on the contents.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Array.prototype.is_equal_to = function(arr)
{
  if (this.length != arr.length)
    return false;

  for (var i = 0; i < arr.length; i++)
  {
    if (this[i].is_equal_to)
    {
      if (!this[i].is_equal_to(arr[i]))
        return false;
      else
        continue;
    }
    if (this[i] != arr[i])
      return false;
  }
  return true;
}