I will share my robust function to enforce whole numbers (because of the integer tag), it has features like optional min/max parameters and -0 protection:
The (... || 0) behind the scenes is dealing with -0 to change it to 0, which is almost always what you want.
The min and max parameters are optional. When blank or invalid values are passed, they will turn into -Infinity and Infinity so they silently don't interfere with Math.min() and Math.max().
You can change Number.isNaN(x) ECMAScript-6 to x!==x (results in true only for NaN) for more compatibility with really old browsers, but this is simply not necessarily anymore.
In case of firefox minmax() is much faster in compare to others. Though in chrome and Edge clamp() is faster than minmax() but difference is ignorable. So, my opinion is to use minmax() according to the benchmark.