Get the sorted order of an array's elements without changing the original array
package{ import flash.display.Sprite;
public class Main extends Sprite{ public function Main(){ var words:Array = ["t", "r", "a", "j"]; var indices:Array = words.sort(Array.RETURNINDEXEDARRAY); trace(words); trace(indices); for(var i:int = 0; i < words.length; i++) { trace(words[indices[i]]); } } } } t,r,a,j 2,3,1,0 a j r t
Related Scripts with Example Source Code in same category :