I have created a code snippet to validate and submit a contact form:
formValidation: function() {
if (
this.formData.name &&
this.formData.company &&
this.formData.email &&
this.formData.industry &&
this.formData.phone &&
this.formData.inquiryType &&
this.formData.message &&
this.formData.captchaResponse
) {
return true;
}
}
Now, I want to execute another function when the validation returns "true". Should I do it like this:
return true;
return callAnotherFunction();
Or should I create a separate check function like this:
if (formValidation() === true) {
callAnotherFunction();
}