4 Replies Latest reply on Oct 19, 2008 6:13 PM by kglad

    Math.min & Array

    mkayyali Level 1
      Hey,

      i have array and i need to get the smallest value on it, i tried Math.min, but its compare by 2 values only...

      var myArray = [20, 12, 60, 4]
      var myMin = Math.min.apply(Math, myArray);
      trace(myMin); // result = 12

      even though the 4 is smaller.

      Thanks a lot