Dating for the Ages

An interesting tweet came across my Twitter stream regarding dating. For the nerds out there, i thought I’d include a little Javascript to show how to create a lookup table. I started by setting up the main loop to start when your age is 18 and goes up thru the age of retirement. Hopefully, by the time you retire, you won’t have to worry about dating anymore. :) Just to make sure were keeping things legal I added an check to ensure they’re the age of consent. That’s 18 in most US states.

OH: Take half your age and add 7 years. That's how young you can date. Everyone knows this

<script type="text/javascript">
out = "Your Age => Their Minimum Age\n";
out += "----------------------------\n";
for (ya = 18; ya <= 65; ya++){
    ta = (ya / 2) + 7;
    if (ta >= 18){
        // keep it legal
        out += "       " + ya + " => " + ta + "     \n";
     }
}
alert(out);
</script>

As a bonus I’ve put this script into a link so you use this from your toolbar. Just drag the link to your browser toolbar to show Dating Age table.

Sorry, but comments are closed. I hope you enjoyed the article