I have an array that I am using, I am having difficulties describing what kind of an array it is, which is making it hard for me to work with it. So far it works for me. I am just curious.
I eventually want to remove the end of this array.
I tried .pop()
and .grep()
. Its not working.
Here is an example of my code.
var options = {}; $('.option:visible').each(function(){ var option_label = ""; var option_selected = []; var option_img = ""; ... options[option_label] = { option_selected: option_selected, option_image : option_img }; });
What I am trying to do is:
if(option_label.indexOf("something") != -1) { //then pop off options } //continue about your business
For clarification I wont know the exact title of the option_label
.
We can remove duplicate element in an array by 2 ways: using temporary array or using separate index. To remove the duplicate element from array, the array must be in sorted order. If array is not sorted, you can sort it by calling Arrays. sort(arr) method.
It is a Javascript Object. You might want ot have a look at this question to remove properties, it gives different ways to to that. One of them is :
delete options.something;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With