Press "Enter" to skip to content

Default Argument Examples in JavaScript

Definition:

 These are the arguments which are meant for initializing value of variables with default values if user did not assign any value pass to function.

Program :

<html>

     <head>

                     <script language=”javascript”>

                                     function display(a=0,b=0,c=0)

                                                 {

                                                 return(a+b+c)

                                                 }

                                                 document.write(display(10,20));

                                </script>

                </head>

                <body>

                </body>

</html>

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *