diff --git a/src/index.js b/src/index.js index 83dabdd87..1bee3ff2b 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,11 @@ module.exports = function reverse (n) { - + let numAbs = Math.abs(n); + + if (numAbs.toString().length === 2) { + let arr = [...numAbs.toString()].reverse(); + arr.push('0'); + return Number(arr.join('')); + } else { + return Number([...numAbs.toString()].reverse().join('')); + } }