title: Underscore.js to check if element in array exists?
body: <p>How do I check if the element in the array exists in underscore.js? For example, I have <code>['aaa', 'bbb', 'cfp', 'ddd']</code>, and want to check to see if <code>'cfp'</code> exists. If it does, I want to show some text. My code below doesn't work and I'm not sure why:</p>
  
  <pre><code>&lt;% _.each(profile.designations, function(i) { %&gt;                                                                                        
              &lt;% if (typeOf profile.designations[i] == "cfp") { %&gt;                                                                                         
  
              &lt;div class="cfp-disclosure-text"&gt;                                                                                                           
  
                &lt;p&gt;Show this text if does exist&lt;/p&gt;                                                                                                                                      
  
              &lt;/div&gt;                                                                                                                                       
  
              &lt;% } %&gt;                                                                                                                                     
  
              &lt;% }); %&gt;
  </code></pre>