Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get smallest key from an array using JS

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 167
    Comment on it

    Hello Reader's! if you have to get the smallest number from the array, Then you can use the JS for short calculation. And here is the example:-

    Lets say the array is

    [0] = 54.25
    [1] = 536.2
    [2] = 100.2
    

    Now make a function and use the Math.min.apply function in it.

    Array.min = function( array ){
        return Math.min.apply( Math, array );
    };
    and then:
    
    var minimum = Array.min(array);
    

 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: