473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

function return

smiley22
function prevValue(value) {
...
... ... return value;
...
... }
...
...
... function call(){
...
... var variable;
... variable = return value;

......
... }

how can I get the return value in order for me to assign it in the variable in the function cal() ?

thanks guys for your replies...
Jun 12 '07 #1
5 1471
r035198x
13,262 8TB
function prevValue(value) {
...
... ... return value;
...
... }
...
...
... function call(){
...
... var variable;
... variable = return value;

......
... }

how can I get the return value in order for me to assign it in the variable in the function cal() ?

thanks guys for your replies...
To call a function inside another funtion you just put the function name and provide the required arguments e.g to call prevValue inside call, you simply do
Expand|Select|Wrap|Line Numbers
  1. var myValue = prevValue(aValue);
Jun 12 '07 #2
dmjpro
2,476 2GB
To call a function inside another funtion you just put the function name and provide the required arguments e.g to call prevValue inside call, you simply do
Expand|Select|Wrap|Line Numbers
  1. var myValue = prevValue(aValue);
remember one thing that if a function does not return any value then the return value is undefined.

look at this example .....

Expand|Select|Wrap|Line Numbers
  1. function test()
  2. {
  3. //my code but no return value.
  4. }
  5. function another_test()
  6. {
  7.  alert(test()); //It will alert an undefined value.
  8. }
  9.  
Okkk.
Have a good day.

Kind regards,
Dmjpro.
Jun 12 '07 #3
To call a function inside another funtion you just put the function name and provide the required arguments e.g to call prevValue inside call, you simply do
Expand|Select|Wrap|Line Numbers
  1. var myValue = prevValue(aValue);
but what if i already called the function inside another function and what i want is to assign the return value to a variable to another function, a third function.


thanks for your time..

gudluck.
Jun 12 '07 #4
ronnil
134 Expert 100+
then you return the value in your second function?

Expand|Select|Wrap|Line Numbers
  1. function function1(somevalue)
  2. {
  3.     return somevalue
  4. }
  5.  
  6. function function2()
  7. {
  8.     var aValue = 'something';
  9.     return function1(aValue);
  10. }
  11. function function3()
  12. {
  13.     return function2();
  14. }
  15.  
  16. function3() //Returns 'something'
Jun 12 '07 #5
then you return the value in your second function?

Expand|Select|Wrap|Line Numbers
  1. function function1(somevalue)
  2. {
  3.     return somevalue
  4. }
  5.  
  6. function function2()
  7. {
  8.     var aValue = 'something';
  9.     return function1(aValue);
  10. }
  11. function function3()
  12. {
  13.     return function2();
  14. }
  15.  
  16. function3() //Returns 'something'
i have a return value but i cannot access its value and assign it a variable in function3(), function3() will just access the return value and assign in variable.

thanks for your replies.

it was highly appreciated....
Jun 12 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: vegetax | last post by:
I i need a decorator that adds a local variable in the function it decorates, probably related with nested scopes, for example: def dec(func): def wrapper(obj = None): if not obj : obj = Obj()...
9
by: Derek Hart | last post by:
I wish to execute code from a string. The string will have a function name, which will return a string: Dim a as string a = "MyFunctionName(param1, param2)" I have seen a ton of people...
17
by: strout | last post by:
function F(e) { return function(){P(e)} } Can anybody tell me what the code is doing? If return another function all in a function I would do function F(e)
14
by: Mr Newbie | last post by:
I am often in the situation where I want to act on the result of a function, but a simple boolean is not enough. For example, I may have a function called isAuthorised ( User, Action ) as ?????...
23
by: bluejack | last post by:
Ahoy... before I go off scouring particular platforms for specialized answers, I thought I would see if there is a portable C answer to this question: I want a function pointer that, when...
18
by: ben.carbery | last post by:
Hi, I have just written a simple program to get me started in C that calculates the number of days since your birthdate. One thing that confuses me about the program (even though it works) is...
4
by: simon | last post by:
hi, I would like to separate my javascript completely from my xhtml. in the end there should be only <script type="text/javascript" src="javalib.js"></script> in the head-tag to my javascript....
27
by: Terry | last post by:
I am getting the following warning for the below function. I understand what it means but how do I handle a null reference? Then how do I pass the resulting value? Regards Warning 1...
6
kiss07
by: kiss07 | last post by:
Dear debas and friends, 1)what is the use of NOCOPY parameter? 2)function overloading ------------------------------- which are the correct function overloading: 1) function f1(c in...
10
by: Matthew | last post by:
Am I correct in thinking there is no method/function overloading of any kind in any version of PHP? Thanks, Matthew
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.