Test whether the property value of each property in the object is not empty
var opt= true
var form={id:1,name:'xx',sex:''}
for(let key in form){
if(!Boolean(form[key])){
opt= false //First define an opt with its true, false to determine if there is empty data in the object
return
}else{
opt= true
}
}
Read More:
- Golang: How to determine structure whether it is empty
- Javascript SecurityError: Failed to read the’localStorage’ property from’Window’: Access is denied for this document.
- [Solved] Error in callback for watcher “value“: “TypeError: Cannot read property ‘level‘ of null“
- Uni-app Error when assigning a value to a component: [system] TypeError: Cannot read property ‘name‘ of undefined
- [Solved] vue.esm.js?efeb:591 [Vue warn]: Error in event handler for “click“: “TypeError: Cannot read property
- [Vue warn]: Error in callback for watcher “fileList”: “TypeError: Cannot create property ‘uid’ on string
- [Solved] Vue element UI form verification error: cannot read property ‘validate’ of undefined
- [Solved] Vue Error: TypeError: Cannot read property ‘end‘ of undefined
- [Solved] TYPEERROR: CANNOT READ PROPERTY ‘REDUCE‘ OF UNDEFINED
- Error: Computed property “menuList” was assigned to but it has no setter.
- About JS error uncaught syntax error: invalid shorthand property initializer
- uniapp Use render Function Error: [Vue warn]: Error in beforeCreate hook: “TypeError: Cannot read property ‘_i‘ of
- vue Error: Uncaught SyntaxError: Invalid shorthand property initializer
- [Solved] JS Error: cannot set property xxx of undefined
- VScode vue Project Error: Property ‘xxx‘ does not exist on type ‘CombinedVueInstance<{ readyOnly…Vetur(2339)
- [Solved] Install The Latest Version of Jest Error: TypeError: Cannot read property ‘instrument‘ of undefined
- Cannot read property ‘isFile‘ of undefined [How to Solve]
- [Solved] Cannot read property ‘setCheckedKeys‘ of undefined“
- [Vue warn]: Error in v-on handler: “TypeError: Object(…) is not a function“
- Vue cannot read property ‘xxx’ of undefined solutions