I have a struct like this:
Code JavaScript:
function Sampe(name, value, unit)
{
   this.name = name;
   this.value = value;
   this.unit = unit;
}

I then have an array of instances of this struct. I'm trying to create a search feature and need to loop through each instance of the struct in my array. Then I need to loop through each value in the struct and check it for a substring. If a substring is found the entire struct instance is printed and the search will skip to the next struct instance. Right now my loops are not working properly. The loop below with 'item' is not correct as 'item' just prints out a number (should be a text value). Any suggestions?

Code JavaScript:
function searchView(text)
{
   document.getElementById("searchResult").innerHTML = "";
   if(text.length > 2){
      //Search through all conditions
      for(data in conditions) {
         //Search through each field in the condition struct
         for(item in data){
            //Check to see if 'text' is a substring of the condition field
            if(item.lastIndexOf(text)){
               var string = "";
               //print the entire condition
               for(item in data){
                  string += data[item] + " | ";
               }
               document.getElementById("searchResults").innerHTML = string;
               //Skip to next condition
               break;
            }
         }
      }
   }
}