/ Published in: ActionScript 3

Looking forward for the most optimized solution for the same
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> <mx:Script> <![CDATA[ // second highest element in an array public var arr:Array = new Array("23", "12", "45", "22", "42", "87", "97", "13") public function init():void{ arr.sort(); txt.text = arr[arr.length - 2] // 87 for(var i=0;i<arr.length;i++){ txt.text += "\n "+arr[i]; } } ]]> </mx:Script> <mx:TextArea x="118" y="57" width="553" height="412" id="txt"/> </mx:Application>
Comments
