Rename map-number-range.md to mapNumRange.md

This commit is contained in:
Yusof Bandar
2019-02-18 14:28:32 +00:00
committed by GitHub
parent cb9124e06b
commit a6a4ea777b

15
mapNumRange.md Normal file
View File

@ -0,0 +1,15 @@
### mapNumRange
Maps a number from one range to another range.
Returns the mapped num from the in range to the out range.
```js
const mapNumRange = (num, in_min, in_max, out_min, out_max) => {
return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
```
```js
mapNumRange(5,0,10,0,100); // '50'
```