Skip to content

How do i make my function return ture or false ? #196

Locked Answered by koustov
Deepak8717 asked this question in Q&A
Discussion options

You must be logged in to vote

How I understood your query is, that you want to have a consolidated return type for all your validations.
Going by the above understanding, you can prepare your return type from the core of the stack. A simple tweak to the above logic would be

const validateEmail = (emailvalue) => {
   if emai is not valid
      shows error
      return false
     else
       hide error
       return true
 }


const comparePassword =(pass, confirmPass)=>{
    if passwords do not match
       shows error
      return false
     else
       hide error
       return true
}


const validate=(value)=>{
    checks if values are empty
           shows  error
            return true
        else
              hide 

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Deepak8717
Comment options

Deepak8717
May 19, 2022
Collaborator Author

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants