A prototype function for finding out if an array contains an element. Works for both JS and Actionscript.

1
2
3
4
5
6
7
8
9
Array.prototype.contains = function(value)
{
  for (var i=0; i<this.length; i++)
  {
    if (this[i] == value)
      return true;
  }
  return false;
}