Monday, 19 August 2013

Array.splice doesn't change the length

Array.splice doesn't change the length

I have a function where I delete some parts of an Array using .splice, but
when I look about console.log on it's length it hasn't changed.. and with
hexdump I also saw that the "deleted" string is still there
e.g.
Array = [3, 7]
function...
Array.splice(Array.indexOf(3), 1)
console.log(Array, Array.length, Hexdump.dump(Array))
= [7] 2 /*Zusammenfassung des hex:*/ 3, 7
(the value that shall be deleted comes from an other var, that's why I
wrote the part with the "indexOf")
What can I do, to delete the value once and for all?
because I have an IF that needs to know the length of my Arrays...

No comments:

Post a Comment