/    Sign up×
Community /Pin to ProfileBookmark

Passing Value of Variable as Parameter between functions

First off, Hello everyone in this forum. Secondly and the point of my post.

Question: How do I pass the value of a variable as a parameter when calling a function from within another function?

Senario: In the one function I am running a couple user defined numbers through a formula. After the numbers are calculated the resulting value is assigned a variable name. At this point I want to call functionNumberTwo(ValueOfVariable). Now how would I make the value of the variable pass as a parameter to the second function?

Temp Fix: I have combined the two functions so the unique calculations run streamline in one function. This solves my current issue, however does not illustrate an answer to the above mentioned question. I would be interested to hear peoples feedback on the question.

Thanks in advance and have a good day.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@PittimannJun 15.2004 — Hi!

Example (doesn't make a difference, that my variable is not a result of some executed code):[code=php]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function functionNumberOne(){
var str="blahblahblah";
functionNumberTwo(str);
}
function functionNumberTwo(ValueOfVariable){
alert(ValueOfVariable);
}
//-->
</script>
</head>
<body>
<a href="#" onclick="functionNumberOne()">click</a>
</body>
</html>[/code]
Cheers - Pit
×

Success!

Help @custom 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,
)...