title: javascript: how to loop through date object
body: <p>I'm not sure how to ask this, but is there a way to get the current local full year and then create a loop to get the last 18 years and print them to the screen?</p>
  
  <p>Here is what I've tried...</p>
  
  <pre><code>function allYears(){
    var d = new Date();
    var y = d.getFullYear();
    var years = '';
    for(var i=0; i&gt;18; i++){
      years += '&lt;option value="'+y+'"&gt;'+y+'&lt;/option&gt;';
      y = y-1;
    }
  return(years);
  }
  </code></pre>