Recursive program to check if number is palindrome or not | recursive function that returns the reverse of digits ; base case ; stores the reverse of a number ; Driver Code
function rev ( n , temp ) { if ( n == 0 ) return temp ; temp = ( temp * 10 ) + ( n % 10 ) ; return rev ( Math . floor ( n / 10 ) , temp ) ; } let n = 121 ; let temp = rev ( n , 0 ) ; if ( temp == n ) document . write ( " " + " " ) ; else document . write ( " " + " " ) ;