Does delete leave a hole in an array in JavaScript?
Deleting an array element looks like it should shrink the array. It does not. Here is what a real run in Node.js 22 printed. The test const a = [ 1 , 2 , 3 ] ; delete a [ 1 ] ; console . log ( a ) ; // [ 1, , 3 ] console . log ( a . length ) ; // 3 console . log ( JSON . stringify ( a ) ) ; // [1,n…
Read the full story at DEV Community — AI ↗
Timeline · 1 report
- 2026-12-05 21:40 · DEV Community — AI
Does delete leave a hole in an array in JavaScript?