Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

clamp function js

// Javascript
const clamp = (number, min, max) =>
   Math.max(min, Math.min(number, max));

// Typescript
const clamp = (number: number, min: number, max: number) =>
   Math.max(min, Math.min(number, max));
 
PREVIOUS NEXT
Tagged: #clamp #function #js
ADD COMMENT
Topic
Name
2+1 =