Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

reverse

var reverse = function(x) {
    
    
  if(x<0)return -1*reverse(-x)

  const solution = (x+'').split('').reverse().join('')
 return (solution >2**31-1)?0:solution
}

console.log(reverse(-123))
 
PREVIOUS NEXT
Tagged: #reverse
ADD COMMENT
Topic
Name
8+2 =