From 0eafaadfaa9d43a992205b4acf3e95e61b614ef9 Mon Sep 17 00:00:00 2001 From: Lia <106583624+Liaaaaaaaaaaa@users.noreply.github.com> Date: Sat, 14 Jan 2023 20:20:51 +0300 Subject: [PATCH] feat: add function --- src/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 83dabdd87..6b6ef1082 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,13 @@ module.exports = function reverse (n) { - + + let Massive = String(n).split(''); + + if (Massive[0] === '-') { + n = Massive.splice(1, (Massive.length -1)).reverse().join(''); + return n; + } else { + n = Massive.reverse().join(''); + return n; + } +} }