How to check there is object inside an array in javaScript? What is the efficient way to find out if a JavaScript array contains an object? This is the only way I know to do it:
[code]
function contObj(array, obj)
{
for (var i = 0; i < (array.length; i++)
{
if (array[i] === obj)
{
return true;
}
}
return false;
}
[/code]
thanks