Code: Select all
function getIndexOfHighestValue numberArray
  -- Example: Input="3,7,5,1"; Output="2"
  put the itemDel into myOldDel
  set the itemDel to comma
  repeat with x = 1 to item 2 of line 1 of extents(numberArray)
    put numberArray[x] & comma & x into line x of numberList
  end repeat
  sort lines of numberList descending numeric by item 1 of each 
  put item 2 of line 1 of numberList into theAnswer
  set the itemDel to myOldDel
  return theAnswer
end getIndexOfHighestValue

 I used Mark's code to improve mine and he did the same. Consider it collaborative solution finding
 I used Mark's code to improve mine and he did the same. Consider it collaborative solution finding  .
.