JavaScript फंक्शन से मान लौटाने के लिए JavaScript में return स्टेटमेंट का उपयोग करें। मान लौटाना सीखने के लिए निम्न कोड चलाएं:
उदाहरण
<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>