# Highest number variable?

**URL:** <https://forum.kirupa.com/t/highest-number-variable/60382>\
**Category:** Uncategorized\
**Created:** [August 9, 2004, 1:27pm UTC](https://forum.kirupa.com/t/highest-number-variable/60382 "2004-08-09T13:27:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![imadesigner](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@imadesigner](https://forum.kirupa.com/u/imadesigner)\
**Post date:** [August 9, 2004, 1:27pm UTC](https://forum.kirupa.com/t/highest-number-variable/60382/1 "2004-08-09T13:27:45Z")

</div>

oh this should be sooo easy but i just cant work it out. Check the code:

```auto
var myCategory1 = 3;
var myCategory2 = 6;
var myCategory3 = 10;
var myArray = Array(myCategory1, myCategory2, myCategory3);
myArray.sortOn(18);
trace(myArray[0]);

```

So as we (all) know Flash will trace the number 10 (highest number in the array), but i need to know what variable 10 came from? eg. did 10 come from myCategory1, myCategory2, myCategory3?

Tom

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 9, 2004, 4:19pm UTC](https://forum.kirupa.com/t/highest-number-variable/60382/2 "2004-08-09T16:19:13Z")

</div>

Numbers are primitive types in actionscript. You have to match the value of the variable with the target value using the equality operator.

I think there might be a better way, if you could clarify what exactly do you need to do. Math.max can help.

Btw, did you mean Array.sortOn (Array.Numeric). 16 instead of 18?
