I want to check if there is any empty field or not before submitting form. But the problem is I have variable number of fields (value1,value2...) So i can not use simple if statement.
So is there any way i can archive this.
state1 = {
vale1:'',
vale2:'',
vale3:'',
vale4:''
}
state2 = {
vale1:'21',
vale2:'a',
vale3:'f',
vale4:''
}
state3 = {
vale1:'fdf',
vale2:'fgf',
vale3:'gf',
vale4:'hg'
}
state4 = {
vale1:'21',
vale2:'a',
vale3:'f'
}
functionIWant(state1) ----> false
functionIWant(state2) ----> false
functionIWant(state3) ----> true
functionIWant(state4) ----> true
Is there any functionIWant ?
''.null,undefinedand empty string''. please add what type you have and what you want as valid value.