Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

JS function returns "undefined" [duplicate]

$
0
0

This question already has an answer here:

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); 
            }
        }
    }

Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>