Get the number which when multiplied will give you the closest to a target number - Javascript Data Type

Javascript examples for Data Type:Float

Description

Get the number which when multiplied will give you the closest to a target number

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from w  w  w . j av a 2  s.com*/
function findFactor(a, b) {
    return Math.floor(a / parseFloat(b));
}
console.log(findFactor(2062, 0.75))
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials