<!DOCTYPE HTML> <html> <head> <title>Untitled</title> </head> <body> <script> function foo(from, to,rang) { return from -(from-to)*rang } alert(foo(1, 0.22, 0.6)) </script> </body> </html>