Reputation: 1632
I have particular function named profilefrm()
in which I am checking conditions returning true or false, I have created another function checkcontacts()
. I have called this function in first one. I have successfully returning true or false from second one. I have flow is
function profilefrm(){
if condition1{
// on false
returning false;
}
checkcontacts();
}
function checkcontacts(){
if condition1{
// on false
returning false;
}
return true;
}
But issue is on false condition in second function it is taken as true in first one. and refreshing page accordingly.
Upvotes: 0
Views: 346
Reputation: 979
function's return value should specify. function do no return if not specify.
firtst function change to below.
function profilefrm(){
if condition1{
// on false
returning false;
}
return checkcontacts();
}
Upvotes: 0
Reputation: 1038720
You could return the result of the checkcontacts
function:
function profilefrm() {
if (condition1) {
// on false
return false;
}
return checkcontacts();
}
Upvotes: 1