Skip to content

Instantly share code, notes, and snippets.

@codergautam
Created October 24, 2021 16:40
Show Gist options
  • Save codergautam/cf56b12e6bce79a89b322df49fa3ba6b to your computer and use it in GitHub Desktop.
Save codergautam/cf56b12e6bce79a89b322df49fa3ba6b to your computer and use it in GitHub Desktop.
A simple js clamp function
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment