[javascript-dev] Re: Re: [sharingisfun] js based change filter
John Pitcairn
cycling74forum at opuslocus.net
Fri Sep 7 21:06:30 MDT 2007
- Previous message: [javascript-dev] Re: [sharingisfun] js based change filter
- Next message: [javascript-dev] Re: Re: [sharingisfun] js based change filter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Quote: Emmanuel Jourdan wrote on Sat, 08 September 2007 03:55
----------------------------------------------------
> it's an easy way to copy the array, which is usually a lame is
> JavaScript.
I don't see any practical difference between a hypothetical array copy method like:
newarray = oldarray.copy();
and using the slice method:
newarray = oldarray.slice(0);
But in any case, you can always add a copy method to the Array object prototype:
Array.prototype.copy = function()
{
return this.slice(0);
}
a = new Array(1, 2, 3, 4, 5);
b = a.copy();
post(b);
- Previous message: [javascript-dev] Re: [sharingisfun] js based change filter
- Next message: [javascript-dev] Re: Re: [sharingisfun] js based change filter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
