Use the return statement to display the name "Mary" in a <p> element: - Javascript Function

Javascript examples for Function:Function Return

Description

Use the return statement to display the name "Mary" in a <p> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<script>
function myFunction(name) {//from   ww w  .j a va 2s  .co  m
    return "Hello " + name;
}
document.getElementById("demo").innerHTML = myFunction("Mary");
</script>

</body>
</html>

Related Tutorials