how to retrun value in a function in javascript

Solutions on MaxInterview for how to retrun value in a function in javascript by the best coders in the world

showing results for - "how to retrun value in a function in javascript"
Laly
03 Feb 2020
1<html>
2   <head>
3      <script>
4         function concatenate(name, age) {
5            var val;
6            val = name + age;
7            return val;
8         }
9         function DisplayFunction() {
10            var result;
11            result = concatenate('John ', 20) ;
12            document.write (result );
13         }
14      </script>
15   </head>
16   <body>
17      <p>Click the following button to call the function</p>
18
19      <form>
20         <input type = "button" onclick = "DisplayFunction()" value = "Result">
21      </form>
22   </body>
23</html>