title: How can I get a specific parameter from location.search?
body: <p>If I had a URL such as</p>
  
  <pre><code>http://localhost/search.php?year=2008
  </code></pre>
  
  <p>How would I write a JavaScript function to grab the variable <em>year</em> and see if it contains anything?</p>
  
  <p>I know it can be done with <code>location.search</code> but I can’t figure out how it grabs parameters.</p>