Delete operator in arrays in JavaScript

You can delete array elements using the delete operator. Let's look at examples. Let's say we have an array like this:

let arr = ['a', 'b', 'c'];

Let's delete one of the elements of our array:

delete arr[1];

As a result, the element will be deleted, but the array will become sparse:

console.log(arr); // shows ['a',, 'c']

Given an array:

let arr = ['a', 'b', 'c', 'd', 'e'];

Delete two elements from it. Check the value of the property length after that.

enru