Answer the question
In order to leave comments, you need to log in
How to correctly write a check for the values of the keys of an object for emptiness, the key value can also be an object?
There is an object in data():
data: function() {
return {
car: {
model:null,
year:null,
power:null,
number:null,
doc: {
type: null,
number: null,
date:null,
},
card: {
item: null,
date: null,
},
card_our: false,
vin: '',
body_number: '',
chassis_number:''
},
}
}
validateObject: function(obj,exclude = null) {
obj = Object.assign({}, obj);
for (let key in obj) {
if (exclude && exclude.includes(key)) continue;
if (obj[key] == null || obj[key] == '') return false;
}
return true;
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question