Return to Snippet

Revision: 11581
at February 10, 2009 10:41 by badabam


Initial Code
var a:Array = [1, 2, 3, 4, 5];
var b:Array;

//clone a:
b = a.map(function(e:*, ...r):*{ return e });


/*
"...r" is a "rest" and stands for the two more arguments, the function in map(f:Function, target:Object = null) needs.

Full function would be: function (element:*, index:int, array:Array):*{return e};
*/

Initial URL
http://www.badabam.de

Initial Description


Initial Title
Clone array (AS3)

Initial Tags
actionscript, array, Flex

Initial Language
ActionScript 3