Returning Value of Functions in JavaScript | Use of JavaScript

Returning Value of Functions in JavaScript | Use of JavaScript

In this article, you will get information about Returning Value of Functions in JavaScript. If you want to learn about it then you must read the full article till the end. I hope you will like this article.

Picture of use of functions in JavaScript




What is returning value of functions?

How to use functions in JavaScript?

How to implement functions in JavaScript?

If these entire questions are related to your query then you are at right place. Here you will get the right information about this topic.

If you want to become a successful web designer or front end designer then you must have good knowledge of JavaScript. So you can learn JavaScript from here.

If you want to learn about functions then you should read the previous article. You can move to the previous article from below link.

Use of Functions in JavaScript




If you want to boost your JavaScript programming knowledge then you must read this book. It is really a wonderful weapon to learn JavaScript.

Returning Value of Functions

Here I am giving you some useful points about returning value of functions in JavaScript.

  • Functions may return a value using keyword “return”.
  • Functions can only return one value.
  • Once a function returns a value, control returns back to the caller.




Example:

<!DOCTYPE html>
<html>
<head>
	<title>Return Value of functions</title>
</head>
<script type="text/javascript">
	function sum(a,b){
		return(a+b);
	}
</script>
<body>
<h1>Welcome</h1>
<script type="text/javascript">
	var s=sum(3,8);
	document.write("sum of a and b :"+s);
</script>
</body>
</html>




Output:

Returning Value of Function in JavaScript

Conclusion

Finally, I hope you got information about Returning value of functions in JavaScript. I hope now you understand how to use functions with returning value.




If you have any questions regarding this article then you can ask me in the comment section below.

Thank you for reading this article till the end.

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate »