SOURCE

function hasEmptyField(obj) {
  if (typeof obj === 'string') {
    obj = JSON.parse(obj)
  }
  if (obj instanceof Object) {
    for (var attr in obj) {
      // 属性值不为'',null,undefined才加入新对象里面(去掉'',null,undefined)
      if (obj.hasOwnProperty(attr) && (obj[attr] === '' || obj[attr] === null || obj[attr] === undefined)) {
          return true
      }
    }
  }
}

const testObj = {
    a: '',
    b: 123,
    c: null,
    d: undefined,
    e: [],
    f: [1,2,3,'',null],
    g: {},
    h: {x:1,y:'',z:null}
}

console.log(hasEmptyField(testObj))
console.log(JSON.stringify(hasEmptyField(testObj)))
console 命令行工具 X clear

                    
>
console