What exactly does these associative array method does? next,prev

Hi Dave,

Thanks for the reply.
EDA Link: Associative array - EDA Playground

fruits= '{“apple”:6,“orange”:2, “guava”:3, “watermelon”: 9,“grape”:1};
//OUTPUT//
Previous fruit of guava is [grape] = 1
Next fruit of guava is [guava] = 3

My understandings.
index of apple=0,
index of orange=1,
index of guava=2,
index of watermelon=3,
index of grape=4,

The next() method finds the smallest index whose value is greater than the given index argument.
=> value greater than guava’s(3) :apple(6),watermelon(9) but here smallest index is apple

The prev() method finds the largest index whose value is smaller than the given index argument.
=> value smaller than guava’s(3):grape(1),orange(2) but largest index is grape.

Let me know if my understanding is correct.

If my understanding is correct then output is wrong.