This question already has an answer here:
- Recursive function returns undefined 2 answers
I looked everywhere but couldn't find an answer.
I tried a lot, but there's no way this function will return "true" or "false".
Any idea ?
function calculEven(nbTest, even, odd){
target = 4;
if(nbTest == (even)){
if(nbTest==target){
return "even" ;
}else {
nbTest++;
even+=2;
odd +=2;
calculEven(nbTest,even,odd);
}
}else {
if(nbTest==target){
return false;
}else {
nbTest++;
odd+=2;
even+=2;
calculEven(nbTest,even,odd);
}
}
}