logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

ArrayAccess.as (425B)


  1. // input: [["a", "b", "c", "d"]]
  2. // output: ["c", "b", "a", "d"]
  3. package {
  4. public class ArrayAccess {
  5. public static function main(ar:Array):Array {
  6. var aa:ArrayAccess = new ArrayAccess();
  7. return aa.f(ar, 2);
  8. }
  9. private function f(ar:Array, num:Number):Array{
  10. var x:String = ar[0];
  11. var y:String = ar[num % ar.length];
  12. ar[0] = y;
  13. ar[num] = x;
  14. return ar;
  15. }
  16. }
  17. }