Assume we are dealing with an environment which could only store
integers within the 32-bit signed integer range: [−2^31, 2^31 − 1]. For
the purpose of this problem, assume that your function returns 0 when
the reversed integer overflows.

The approach is to stringify the number, arrayify the string, reverse it, re-join the array into a string and finally parse the reversed string to an integer. parseInt called on a string such as "546-" will strip the trailing -. Then, handle overflow and positive/negative conditions and return the result.

In short, avoid overcomplication and take advantage of high-level language features when possible.