'delete element from array without empty slots

I create an array like this and remove one element:

var test = []

test.push({
    bezeichnung: "test_1"
});
test.push({
    bezeichnung: "test_2"
});
test.push({
    bezeichnung: "test_3"
});

delete test[1]

But console.log(test.length) will show me "3", because my array shows an "empty slot" which will also count.

How can I fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source