finding whether a value exists in a javascript object with jquery
<p>I am trying to determine whether a object contains a specific value so that I can be sure not append the value I am looking for more than once and prevent recursion.</p>

<p>I have tried lots of methods but can't get any of them to work:</p>

<pre><code>data = [
  {val:'xxx',txt:'yyy'},
  {val:'yyy',txt:'aaa'},
  {val:'bbb',txt:'ccc'}
];

console.log(jQuery.grep(data, function(obj){
    return obj.txt === "ccc";
}));
$.map(data, function(el) { 
    if(el.txt === 'ccc') 
        console.log('found')
});
</code></pre>

<p>Can this be done with map() grep() or inArray() or do I really have to loop through the entire array looking for the value ??</p>
