title: Using "grep" for conditional matching and printing array values in jQuery
body: <p>I am trying to print or alert out the values in array alpha, which start from the letter "P". I must therefore get 2 alerts viz., Peter &amp; Pamela. But,I am unable to get my required 2 alerts. Can someone help me out printing the two "P" starting values using grep only? </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script&gt;
      var alpha = ["Peter","Jones","Pamela"];
      $.grep(alpha,function(i,value){if (alpha[value]=="P*") {alert (alpha[value]) ;} })
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>