Hi viewers,
How to check object key value is null or empty in javascript
function checkProperties(obj) {
for (var key in obj) {
if (obj[key] !== null && obj[key] != "") {
alert("not Empty");
return false;
}
}
alert("Empty");
return true;
}
var obj = {
x: "",
y: "",
z: 1
}
checkProperties(obj) //returns true
console.log("SDfsdfs",checkProperties);
How to check object key value is null or empty in javascript
function checkProperties(obj) {
for (var key in obj) {
if (obj[key] !== null && obj[key] != "") {
alert("not Empty");
return false;
}
}
alert("Empty");
return true;
}
var obj = {
x: "",
y: "",
z: 1
}
checkProperties(obj) //returns true
console.log("SDfsdfs",checkProperties);