I use the following function to dynamically check the properties of a variable number of objects.
// FUNCTION: Check Objects
var ObjectsN = 4;
function CheckObjects()
{
for (var i=0; i<=ObjectsN; i++)
{
if ((eval("Object"+i+".property")==0)
{
if (i==ObjectsN)
{
alert("Function finished");
}
}
else
{
return; // end function
}
}
}
I need to check if each object has the same property value.
Is there a way to do the same without using eval ?
A real example would be really much appreciated.