/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Function passing multiple Arguments

Hi, there is only one part I’m not sure about for this assignment – I am to [COLOR=”#0000CD”]“Call this function from within JS script and pass to the function the following arguments: no arguments”[/COLOR]. Do I just leave it as [COLOR=”#FF0000″]addNum ();[/COLOR] with the [COLOR=”#FF0000″]()[/COLOR] 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);
[COLOR=”#FF0000″]addNum ();[/COLOR]

</script> [/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@giraffedevNov 05.2014 — Yes,no arguments means nothing between those paranthesis.
Copy linkTweet thisAlerts:
@BlondieCauthorNov 05.2014 — Thank you!
×

Success!

Help @BlondieC spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...