codescracker


javascript

JavaScript return Statement



« Previous Tutorial Next Tutorial »


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

JavaScript return Statement Example

Here is an example demonstrates return statement in JavaScript:

<!DOCTYPE HTML>
<html>
<head>
	<title>JavaScript return Statement</title>
</head>
<body>

<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 );
</script>

</body>
</html>

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.


« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test