how to retrun value in a function in javascript code example
Example: how to retrun value in a function in javascript
<html>
<head>
<script>
function concatenate(name, age) {
var val;
val = name + age;
return val;
}
function DisplayFunction() {
var result;
result = concatenate('John ', 20) ;
document.write (result );
}
</script>
</head>
<body>
<p>Click the following button to call the function</p>
<form>
<input type = "button" onclick = "DisplayFunction()" value = "Result">
</form>
</body>
</html>