Javascript: removing element from object
Hi
I have an object in Javascript of a structure like:
objID{ name, arr[], int}
now the arr[] is of the length = 7.
so, its like objID.arr[0] to objID.arr[6].
Now, I have a requirement of removing an element from this array according to the scenario.
Say Idx is the array element to be deleted
So, I tried objID.arr.splice(Idx, 1);
to which I got the exception:
"Microsoft JScript runtime error: Object doesn't support this property or method"
And then I tried delete objID.arr[Idx];
to which I got the exception:
"Microsoft JScript runtime error: Object doesn't support this action"
so, what can be done to remove the element from the object and then adjust the arrays.
Like, if in the starting I have array of 4 elements like:
objID.arr[0] = a
objID.arr[1] = b
objID.arr[2] = c
objID.arr[3] = d
and I remove the element at index 2! the new array should be like:
objID.arr[0] = a
objID.arr[1] = b
objID.arr[2] = d
Thanks in advance!