JavaScript return Statement

The return statement in JavaScript returns a value from a function.

JavaScript return Statement Example

Here is an example demonstrates return statement in JavaScript:

   <title>JavaScript return Statement</title>

<h3>JavaScript return Statement Example</h3>
<script type="text/javascript">
   function calmult(a, b)
      var mult = a*b;
      return mult;
   document.write("The multiplication result of any two number is calculated using calmult() function<br/>");
   var m = calmult(10, 20);
   document.write("Multiplication Result = " + m );


Here is the sample output of the above JavaScript return statement example:

javascript return statement

Here is the live demo output produced by the above JavaScript return statement example program.

JavaScript Online Test

« Previous Tutorial Next Tutorial »