Thursday, August 7, 2014

return in javascript function

<!DOCTYPE html>
<html>
<body>



<p id="demo"></p>

<script>
function myFunction(a, b) {
    return a * b;
}
document.getElementById("demo").innerHTML = myFunction(4, 3);
</script>

</body>
</html>
This example calls a function which performs a calculation, and returns the result:12

No comments:

Post a Comment