Hi everyone,
I am trying yo loop through an array property that is multi-valued and so the condition is if that property has what the value specified then alert with a message saying hello.. The other idea is kinda complex that is to check using RegExp...
Here is the code..
var array = new Array();
array.fruit= "banana, apple";
array.vegies ="cucumber, carrot, tomatos, potatos";
array.drinks = "coke, pepsi";
var pep = "pepsi";
var getVal;
outerloop:
for(var obj in array){
getVal = array[obj];
println(obj + " : " + getVal);
if ( obj.hasOwnProperty( "pepsi") ){ here is the problem
alert("hello");
break outerloop;
}
}
Cheers,