![]() Topic awaiting preservation: Array related question (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Sweden, Malmoe |
![]() Hello, |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() "I was wondering, is there any built in function that easily switches two array elements" |
Nervous Wreck (II) Inmate From: Sweden, Malmoe |
![]() I tried searching the net on how to empty an array but all I came up with was to loop it through and set an empty value for each element. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() To empty an array: |
Bipolar (III) Inmate From: Raleigh, NC |
![]() ooh. that's cool slime. =D My mind is boggling |
Nervous Wreck (II) Inmate From: Utreg, NL |
![]() If you'd need a swap function for arrays at various places in your code, you could add a "swap" (or something else) to the array prototype, for example; code: Array.prototype.swap = function(a, b) {
|
Nervous Wreck (II) Inmate From: Sweden, Malmoe |
![]() Thanks Slime and Clay. I did not know of prototype... |