Try replacing your if
statement with:
if(last_answer != 10){
return countToTen(last_answer);
}
Without the return
statement, the recursive calls do get executed, but the calculated result is never returned.
The order of calls with your broken code looks like:
countToTen(1)
-> countToTen(2)
--> countToTen(3)
---> more calls to countToTen()
--- ... --> countToTen(10) // do nothing, and return to the top-level method call
-> return 2 // 2 because you incremented it using lastAnswer++