Skip to content

Instantly share code, notes, and snippets.

@katepapineni
Created August 4, 2020 14:42
Show Gist options
  • Save katepapineni/f4979d0d3362e6fab308f011ca89af3f to your computer and use it in GitHub Desktop.
Save katepapineni/f4979d0d3362e6fab308f011ca89af3f to your computer and use it in GitHub Desktop.
const min = 4;
const max = 9;
const getNum = num => Math.min(max, Math.max(min, num));
// What's the output?
console.log(getNum(6));
console.log(getNum(3));
console.log(getNum(10));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment