Javascript examples for Function:Function Return
Use the return statement to display the name "Mary" in a <p> element:
<!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>