Post4VPS Forum | Free VPS Provider
Removing data from array - Printable Version

+- Post4VPS Forum | Free VPS Provider (https://post4vps.com)
+-- Forum: Geek World (https://post4vps.com/Forum-Geek-World)
+--- Forum: Scripting & Programming (https://post4vps.com/Forum-Scripting-Programming)
+--- Thread: Removing data from array (/Thread-Removing-data-from-array)



Removing data from array - Decent12 - 11-15-2019

Hello guys, i was searching for how to remove data from array in javascript but i got nothing helpfull from google.
here is the array i created
Code:
var Workers = [];
added data in it by
Code:
var p = "dd", age = 55;
Workers.push({"Name": p, "worker-Age": age})
now i want to delete this data by giving Worker age or by worker name, what should i do?


RE: Removing data from array - fChk - 11-16-2019

(11-15-2019, 03:32 PM)DecĀ ent12 Wrote: (...)
now i want to delete this data by giving Worker age or by worker name, what should i do?

Not sure what you mean by that! But if it is that you're seeking to get the values out of the populated array, then try this:
Code:
> Workers[0].Name;
'dd'
> Workers[0]["worker-Age"];
55

Good luck!


RE: Removing data from array - Decent12 - 11-16-2019

(11-16-2019, 04:51 AM)fChk Wrote: Not sure what you mean by that! But if it is that you're seeking to get the values out of the populated array, then try this:
Code:
> Workers[0].Name;
'dd'
> Workers[0]["worker-Age"];
55

Good luck!
Thanks for your reply but i think i had stated very clearly what i wanted to say but anyways i found the way and i wanted to ask about removing not about fetching data from array.
solution: https://stackoverflow.com/questions/9882284/looping-through-array-and-removing-items-without-breaking-for-loop


RE: Removing data from array - deanhills - 11-16-2019

Thread closed at request of author.