redho home | products | services
Web Design Forums

Web Design Forums  


Web Hosting, Web Design, Software and Web Development Forums  
 FAQFAQ   MemberlistArchive  Log inLog in   RegisterRegister 
         

how delete a particular element from an array



 
Post new topic   Reply to topic    Web Design Forums -> JavaScript forum
View previous topic :: View next topic  
Author Message
Poolkop



Joined: 01 Jun 2006
Posts: 123
How to delete a particular element from an array?
  Reply with quote


Gladis



Joined: 24 May 2006
Posts: 108
Splice
  Reply with quote
autos06



Joined: 13 May 2006
Posts: 123
Location: New York
Poolkop, use delete
Delete myarray[3];
  Reply with quote
Poolkop



Joined: 01 Jun 2006
Posts: 123
Splice works with index
I need to delete a random element each time
  Reply with quote
autos06



Joined: 13 May 2006
Posts: 123
Location: New York
Splice modifies the array indeces
Or at least the length property
  Reply with quote
Poolkop



Joined: 01 Jun 2006
Posts: 123
Mmm
Like say
I have three elementsi n an array
"yahoo", "msn", "google"
But their locations could be random
Msn could be first, yahoo could be 2nd and so on
Now how will i delete "msn"
  Reply with quote
AmeliaR



Joined: 31 May 2006
Posts: 142
Using a temp array?
  Reply with quote
autos06



Joined: 13 May 2006
Posts: 123
Location: New York
For (i=0; i<arr.length; i++) { if (arr[i] == 'msn') break; } delete arr[i]; (assuming that you know msn is in the array somewhere)
  Reply with quote
Poolkop



Joined: 01 Jun 2006
Posts: 123
Ahh, ok, thanks
  Reply with quote
Page 1 of 1
Post new topic   Reply to topic    Web Design Forums -> JavaScript forum


Dubai Forums - Expat Help | Vegan Chat | Java Programming | Free 3D tutorials and 3d textures | Paris Forum | EU Forum
Free Dubai Classifieds | Free London Classifieds | Jobs in London

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Powered by phpBB © 2001, 2005 phpBB Group