How to select the first item in an array
<p>I am having an array for example a <code>['global','flexible','testing']</code> in a JSON response. But on the HTML page i might be having 50 global terms, 20 flexible terms and 100 testing terms. But how to highlight only the first global, first flexible and first testing. I tried with each loop, but getting script error issue. How todo it?</p>

<p>Here is the code...</p>

<pre><code> response= {"glossary":{"errorFlag":"false","terms":"global,flexible,testing","description":"tetestst setwe wetwet tewtw"}};

glossaryterms=response.glossary.terms.split(',');
                   //console.log(glossaryterms);
                   $(glossaryterms).each(function(i,term){
                        $('#contentId').highlight(term, { wordsOnly: true, className: 'terms' + i });
                        var clss="." + "terms" + i;
                        $("#contentId").find(clss).eq(0).addClass("gloss_highlight");

                        var gloss_content = $('#contentId .gloss_highlight');
                        $(gloss_content).each(function(i,obj){
                            if($(obj).html().toLowerCase()==term.toLowerCase()){
                                $(obj).bind('click',function(e) {
                                    $('.glossary').remove();
                                    gloss.glossary.getglossarydesc(term,$(obj));
                                });
                            }
                        });

                    });
</code></pre>
