www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Function passing multiple Arguments

  1. #1
    Join Date
    Oct 2014
    Posts
    41

    resolved [RESOLVED] Function passing multiple Arguments

    Hi, there is only one part I'm not sure about for this assignment - I am to "Call this function from within JS script and pass to the function the following arguments: no arguments". Do I just leave it as addNum (); with the () empty? Thank you.

    Code:
    <script type="text/javascript">
    
    		function addNum(a,b)
    		{
    			if (arguments.length < 2)
    			{
    				return alert("Cannot perform addition.");
    			}	
    			
    			else if (arguments.length == 2)
    			{
    				return alert("The sum of arguments is: " + (a + b));
    			}	
    			
    			else
    			{
    				return alert("The function cannot compute the sum of more than 2 arguments.");
    			}	
    		}
    
    		//These are the three Function Calls
    		addNum (3,5,9);
    		addNum (3,5);
    		addNum ();
    
    	</script>

  2. #2
    Join Date
    Nov 2014
    Location
    http://giraffedev.com
    Posts
    26
    Yes,no arguments means nothing between those paranthesis.

  3. #3
    Join Date
    Oct 2014
    Posts
    41
    Thank you!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles