添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

JavaScript判断数组对象中字段属性值是否有null

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<script>
var list = [
        annualCapacity: 3000,
        filled: false,
        preMonthContractVolume: "1",
        preMonthGoodsVolume: "1",
        preMonthStock: "1",
        remarks: "6",
        taskId: "6"
        annualCapacity: 3000,
        filled: false,
        preMonthContractVolume: "6",
        preMonthGoodsVolume: "1",
        preMonthStock: "1",
        remarks: "96",
        taskId: "5"
function isEmpty(arr) {
    return arr.every(form => {
        let flag = true
        for (let key in form) {
            if (form.hasOwnProperty(key)) {
                if (form[key] === null || form[key] === "") {
                    return false
        return flag