Birthday Villain Name

Get a villain name for a person's birthday. All times are UTC.

by Adrian Mejias

HTML

<h1 id="dob"></h1>
<div id="villain"></div>

CSS

div#villain {
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 3px 5px;
}

JavaScript

var getFirstName = function(month) {
    return ([
      'The Evil', 'The Vile', 'The Cruel', 'The Trashy',
      'The Despicable', 'The Embarrassing', 'The Disreputable',
      'The Atrocious', 'The Twirling', 'The Orange',
      'The Terrifying', 'The Awkward'
    ])[month];
  },
  getSecondName = function(day) {
    return ([
      'Mustache', 'Pickle', 'Hood Ornament', 'Raisin',
      'Recycling Bin', 'Potato', 'Tomato', 'House Cat',
      'Teaspoon', 'Laundry Basket'
    ])[day % 10];
  },
  getVillainName = function(birthday) {
    return getFirstName(birthday.getMonth()) + ' ' + getSecondName(birthday.getDate());
  },
  timestamp = Date.UTC(1983, 3 - 1, 11, 0, 0, 0),
  dob = new Date(timestamp + 8640000);
document.getElementById('dob').innerText = (['January', 'February', 'March', 'April', 'May', 'June', 'July', 'Auguest', 'September', 'October', 'November', 'December'])[dob.getUTCMonth()] + ' ' + dob.getUTCDate() + ', ' + dob.getUTCFullYear();
document.getElementById('villain').innerText = getVillainName(dob);