Let's assume the following two arrays:
javascriptlet array_1 = ['Erik', '', 'Andrea', 'Paula', '']; let array_2 = ['', '', '', '', ''];
To check if an array is filled with empty strings, you can use the Array.prototype.every()
function.
Example:
javascriptlet isEmpty_1 = array_1.every(element => element === ''); // false let isEmpty_2 = array_2.every(element => element === ''); // true
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.