Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions expression to find highest number in array

  • expression to find highest number in array

  • søren kristensen

    July 28, 2021 at 10:54 am

    I feel this should be very simple, but I can’t find the solution. I need an expression that determines which number in an array is the largest.

  • Liran Tabib

    July 28, 2021 at 11:32 am

    Hi Soren

    Let’s say tmpArr is your array, so you can loop through it and find the biggest one:

    var biggestNum = tmpArr[0];
    for(var i = 1;i < tmpArr.length;i++){
    if(biggestNum < tmpArr[i]){biggestNum = tmpArr[i]}


    Liran Tabib

  • søren kristensen

    July 28, 2021 at 12:14 pm

    thank you, works perfectly!

  • Tomas Bumbulevičius

    August 4, 2021 at 7:57 am

    A bit simper one:

    numArray = [1,10,5,3]

    Math.max.apply(null, numArray)

  • Raymundo Firmino De Oliveira Neto

    June 25, 2022 at 5:44 pm

    Very nice!! could you explain a little bit why it does work?

    I was stuck trying to do it like that:

    numArray = [1,10,5,3]


    You saved me

Viewing 1 - 5 of 5 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy