Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Javascript math.min() and math.max() function

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 149
    Comment on it

    JavaScript min() Method
    This method returns number with lowest value
    Here is the example of math.min()

    <p>Click the button to return the lowest number of 5, 10,2,0.</p>
    
    <button onclick="myFunction()">result</button>
    
    <p id="mi"></p>
    
    <script>
    function myFunction() {
        document.getElementById("mi").innerHTML = Math.min(15, 10,2,0);
    }
    </script>
    
    </body>
    </html>
    

    Output
    0

    JavaScript max() Method
    This method returns number with highest value
    Here is the example of math.max()

    <!DOCTYPE html>
    <html>
    <body>
    
    <p>Click the button to return the highest number of 5,10,2,0.</p>
    
    <button onclick="myFunction()">result</button>
    
    <p id="ma"></p>
    
    <script>
    function myFunction() {
        document.getElementById("ma").innerHTML = Math.max(5,10,2,0);
    }
    </script>
    
    </body>
    </html>
    

    Output
    10

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: