如何判空 一个数组里有两个空字符串

img
像上图这种格式应该怎么判断是个空值呢?当值为空的时候则提示不能为空

<script>
        var arr = ['', ''];
        arr.forEach((item, index) => {
            if (!item) {
                console.log('索引为' + parseInt(index + 1) + '位置的元素不能为空');
            }
        });
    </script>


写个for循环判断空,如果是所有值都不能为空就判断为空的个数等于数组长度