How to get the minimum of 2 values?

This one should be easy but I’m struggling.

I have 2 values in my server action.

I want to take the minimum of the two…

Example:

      "read_pct": 12,
      "lowest_scroll_pct": 100

I want to get the lowest value of these 2 (so that’s 12 ).

How?

Edit
I got it working in a dirty way. What’s the clean way?

Community Page
Last updated: