diff --git a/src/index.js b/src/index.js index 83dabdd87..076f390da 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,9 @@ module.exports = function reverse (n) { - + let init = n < 0 ? n * -1 : n; + let initArr = String(init).split(''); + initArr.reverse(); + let result = initArr.join(''); + + return Number(result); + }