Skip to content

Instantly share code, notes, and snippets.

@TheoLeanse
Last active November 29, 2016 12:01
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 TheoLeanse/ffd834d9505bc945e982f9dba8f06964 to your computer and use it in GitHub Desktop.
Save TheoLeanse/ffd834d9505bc945e982f9dba8f06964 to your computer and use it in GitHub Desktop.
const values = [ 50, 500, 5000, 50000 ].sort((a, b) => a - b);
const min = values[0];
const max = values[values.length - 1];
const range = max - min;
const getScore = value => (value - min) / range;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment