Do you know how to scale a value from one range to another?

Conversion:
Online version (html)
Offline version (Blitz)