The ``++delete++`` operator can be used to remove a property from any object. Arrays are objects, so the ``++delete++`` operator can be used on them too.
When you delete an element from an array using the ``++delete++`` keyword, it will remove the value but still leave behind an empty slot at that index. Therefore, a hole will be created in the array because the indexes won't be shifted to reflect the deletion. This means that the array will still have that index, but the value will be ``++undefined++``.
Note that these methods mutate arrays in-place. Alternatively, you could create new arrays using copying methods and exclude the element you want to remove.
You didn't have any languages targeted. I assumed JavaScript...
=== on 29 Apr 2015, 09:02:41 Linda Martin wrote:
\[~ann.campbell.2] Indeed thanks!
I updated the comment in the code snippet to show how the array look like after the deleting the element. I let you remove it or update if you think it is to heavy and not necessary.
=== on 29 Apr 2015, 09:09:47 Ann Campbell wrote:
Your updated looks good to me [~linda.martin]. I just modified it's place in the code slightly.