function getReversedNumber(num) {
  const isNegative = num < 0;
  const reverseNumber = parseInt([...("" + Math.abs(num))].reverse().join(""));

  return isNegative ? reverseNumber * -1 : reverseNumber;
}

console.log(getReversedNumber(12));
console.log(getReversedNumber(-123));
