Saturday, August 15, 2015

Function in JavaScript

In this article I will show you how to declare and use a function in Javascript. A function or method in other programming language like in Java is a module design to return a value. In our example I wrote a function named addition with two passing parameters that will be compute by our function.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.comand jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.



Sample Program Output


Program Listing


<html>
    <head>
        <title> Function in JavaScript</title>
    <head>
        
    <body>
        
        
        <script>
            function addition(a, b) {
                    return a + b;
                                            }
            var sum = addition(10+5,5);
                                            
            alert("The total sum is " + sum + ".");
        </script>
   </body>
</html>

No comments:

Post a Comment