Forum Discussion

rome_castillo's avatar
rome_castillo
Occasional Contributor
10 years ago

Can I pass the object Property Name as a parameter

 I have used FindAllChildren to get all the children of a window object and put it in an array (objArray).  I am trying to pass the Property Name (myName) and Property Value (myValue) to find the ind...
  • Ryan_Moran's avatar
    10 years ago
    function getIndex(objArray, myName, myValue)
    {
        for(var i = 0; i < objArray.length; i++){
            if(objArray[i][myName] == myValue){
            //do stuff
    } { }