像上图这种格式应该怎么判断是个空值呢?当值为空的时候则提示不能为空
2条回答 默认 最新
- 404警告 2021-07-23 09:48关注
<script> var arr = ['', '']; arr.forEach((item, index) => { if (!item) { console.log('索引为' + parseInt(index + 1) + '位置的元素不能为空'); } }); </script>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用