find ids with a specific string
<p>I'm trying to learn JavaScript, and I wanted to change what I am working on into a pure JavaScript solution. How do I change this to JavaScript:</p>

<pre><code>var hrefs = $("a[id^=a_l_]").map(function() {
  return this.href;
}).get();
</code></pre>

<p>It basically finds all id's containing "a_l_" and puts it into an array.</p>

<p>Here is what I have tried</p>

<pre><code>var matches = [];
var elems = document.getElementsByTagName("a");
for (var i=0; i&lt;elems.length; i++) {
  if (elems[i].id.indexOf("a_l_") == 0)
  matches.push(elems[i]);
  console.log(matches);
}
</code></pre>
