How can we return a value from User Defined Function ? For
Eg. we have 2 functions. In Fun1 i am getting 2 values (a,b)
and i am addding those 2 and storing in to another var (c).
Now i want to pass that var(c) to another function (fun2).
What will be the script?

Answers were Sorted based on User's Feedback



How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / krishna chand

Hi Ganesh,

I will try for this. Thank u for sending responce once
again.

Is This Answer Correct ?    1 Yes 0 No

How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / ganesh

<script language="javascript">
function add()
{
var a=parseInt(document.getElementById('x').value);
var b=parseInt(document.getElementById('y').value);
var c= a + b;
fun(c);
}
function fun(disp)
{
alert(disp);
}
</script>
</head>
<body>
Enter First Number:<input type="text" id="x" /><br />
Enter Second Number:<input type="text" id="y" /><br />
<input type="button" value="Add" onclick="add()" />
</body>



Am i right ??

Is This Answer Correct ?    1 Yes 1 No

How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / krishna chand

I don't think so Ganesh because, The same i said in the
interview, then the Interviewr said it is wrong we can not
decalre the function directly like function fun(disp).

Is This Answer Correct ?    0 Yes 0 No

How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / ganesh

Hi Mr. Krishna,
I worked on this code.
its working right ??

Is This Answer Correct ?    0 Yes 0 No

How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / ganesh

k.
try & bck to me !!!

Is This Answer Correct ?    0 Yes 0 No

How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / ramesh

Hi Ganesh/Krishna,

Can you try it out the below one.


function add(out c)
{
c=a+b
add(c)
}

dis=add(c)
function len(dis)
{
count=length(dis)
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Scripts AllOther Interview Questions

why script is client dependant.

0 Answers  


What are the advantages and disadvantages of Descriptive programing and Object repository in QTP??

1 Answers   Impetus,


what is the difference between 32 bit O.S n 64 bit O.S?

1 Answers  


I Am Planning to Write ISTQB foundation level Ceritification of inida. can Any Body let me know how to prepare for it & Any Study material can you provide or Any other E-books i should need to Study. Please Mail to me ajaybe_2004@yahoo.co.in THnaks in advance Ajay

0 Answers  


how do invoke OS task through ANT?

0 Answers  


In the Web page we have a table link, if we click on that link all the contents under that link will be sorted (asscending/Descending). Now i want to check in which order the list is ? for that i need to get the data in to some var How can i get that cells data?

1 Answers   Nous,


what is the Structure of an ANT file?

0 Answers  


'IMP' is not recognized as an internal or external command, operable program or batch file. this is the error message i am getting when i importing dmp for the backup. where is the problem?

3 Answers   Mobilink,


Why we use Action Script(Multimedia Flash) rather than using other scripting languages (JAVA,VB...etc) ?

0 Answers   Wipro,


how can i type the text message in compose box in yahoo mail using descriptive programming in QTP?

0 Answers  


what is the diff between ANT and MAVEN?

2 Answers   Accenture,


database acl level has manager access.his name is listed in author and Reader fields. but he didn't sea a documents what is the reason?

0 Answers  


Categories