Divide number with decimals - Javascript Operator

Javascript examples for Operator:Arithmetic Operator

Description

Divide number with decimals

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <p id="demo">Click the button to see result</p> 
      <button onclick="myFunction(3856,3)">Try it</button> 
      <script>
   function myFunction(number,divide)    {
    var money = number / divide;//from  w  w w  . ja  v  a  2 s  .  co  m
    money = Math.ceil(money * 100) / 100;
    console.log(money);   //1285.34
}

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

Related Tutorials