Skip to content

Instantly share code, notes, and snippets.

@rajasegar
Created March 27, 2018 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajasegar/abc507a94c2124ab4c6a3c117790197d to your computer and use it in GitHub Desktop.
Save rajasegar/abc507a94c2124ab4c6a3c117790197d to your computer and use it in GitHub Desktop.
Communication cohesion
function timeToRetire(birthday) { // birthday is a date
const RETIREMENT_AGE = 65;
let ageDifMs = Date.now() - birthday.getTime();
let ageDate = new Date(ageDifMs); // miliseconds from epoch
let age = Math.abs(ageDate.getUTCFullYear() - 1970)
let _timeToRetire = RETIREMENT_AGE - age;
return _timeToRetire;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment