Javascript / jQuery - map a range of numbers to another range of numbers - Stack Overflow

PHOTO EMBED

Sat Aug 20 2022 19:42:27 GMT+0000 (Coordinated Universal Time)

Saved by @destinyChuck #javascript

const num = 5;
console.log(scale(num, 0, 10, -50, 50)); // 0
console.log(scale(num, -20, 0, -100, 100)); // 150
content_copyCOPY

https://stackoverflow.com/questions/10756313/javascript-jquery-map-a-range-of-numbers-to-another-range-of-numbers