Call functions in return statement - Javascript Function

Javascript examples for Function:Function Return

Description

Call functions in return statement

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
function a(){
    console.log("A");
    return false;/*  w w  w .j  a va2 s. com*/
}
function b(){
     console.log("B");
    return false;
}
function completeFormValidation(){
    return a() && b();
}

      </script> 
   </head> 
   <body> 
      <form action="http://www.google.com" onsubmit="return completeFormValidation();"> 
         <button>test</button> 
      </form>  
   </body>
</html>

Related Tutorials