Skip to content

Instantly share code, notes, and snippets.

@faddah
Created December 13, 2016 01:10
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 faddah/54482188b1c0148bff14acee16bae092 to your computer and use it in GitHub Desktop.
Save faddah/54482188b1c0148bff14acee16bae092 to your computer and use it in GitHub Desktop.
JavaScript trying to add key/value pair with Map.property.set()
document.querySelector('#outcome5').innerHTML = inventors.sort((a, b) => {
const lastPersonAge = a.passed - a.year;
const nextPersonAge = b.passed - b.year;
a.set(age, lastPersonAge);
b.set(age, nextPersonAge);
return nextPersonAge > lastPersonAge ? 1 : -1;
}).map(inventor => ` ${inventor.first} ${inventor.last} — age: ${inventor.passed - inventor.year}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment