1<script>
2function showName() {
3 var result;
4 result = addString('Hello', ' World');
5 document.write (result );
6}
7
8// in below we will check how to return string from function
9function addString(fName, lName) {
10 var val;
11 val = fName + lName;
12 return val; // returning string from function
13}
14</script>
15<input type = "button" onclick = "showName()" value = "Result">
16
17/*
18I hope it will help you.
19Namaste
20Stay Home Stay Safe
21*/
1function add(a, b) {
2 return a + b; //Return stops the execution of this function
3}
4
5var sum = add(5, 24); //The value that was returned got but inside the variable sum
1// --- The following return statements all break the function execution: ---
2
3return;
4return true;
5return false;
6return x;
7return x + y / 3;
8