Click here to Skip to main content
15,885,143 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
JavaScript
function setValue(fName,lName,age){
    setCustInfo(fname);   
    displayCustInfo(lname); 
}

function setCustInfo(name){   
    alert("The name is set as :" + name); 
}

function displayCustinfo(name){
    alert("Name is displayed as :" + name);   
    setValue("James","Bond",30);
}



[Edit member="Tadit"]
Corrected formatting and/or grammatical issues.
Added pre tags.
[/Edit]
Posted
v2
Comments
Abhinav S 29-Apr-15 3:24am    
Run it and find out.

Nothing will happen, unless any of these functions is called in the code.
 
Share this answer
 
Comments
Maciej Los 29-Apr-15 4:01am    
Short and to the point! 5!
Thanks a lot Maciej. :) Long time man. How are you?
Maciej Los 29-Apr-15 6:12am    
Thank you, i'm fine. And how are you?
I am fine too. Did you plan for what we discussed over LinkedIn few months back? :P :P
Maciej Los 29-Apr-15 6:29am    
I'll answer you this question via LinkedIn...
It does not make sense at all. Suggest you read out on JavaScript Objects[^]
 
Share this answer
 
v2
If using the above function's we will not get the alert of displayCustinfo() as the function name is different(Capital I, small i). If we change them then we will get the alert messages.

Here is the code I have tried. If any one find better code please provide here.



<button onclick='setValue("James","Bond",30)'>Submit</button>


script:

function setValue(fname,lname,age){
setCustInfo(fname);
displayCustinfo(lname);
}

function setCustInfo(name){
alert("The name is set as :" + name);
}

function displayCustinfo(name){
alert("Name is displayed as :" + name);

}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900