It makes sense the array length is still 4. You did nothing to modify the actual array, only the values being stored within the array. If you did .pop() instead of that delete then the length would be 3.
The real strange thing you’re glossing over is that undefined is actually a value. It’s essentially a placeholder until other values get set. You can change the value of undefined if you aren’t in strict mode.