From 248f9f8fe5a64e26ce2baef8a0d90c1c0eae387d Mon Sep 17 00:00:00 2001 From: RazaKhan Date: Sun, 9 Oct 2022 20:41:35 +0100 Subject: [PATCH] Problem #9 Javascript --- JS/IsPalindrom.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 JS/IsPalindrom.js diff --git a/JS/IsPalindrom.js b/JS/IsPalindrom.js new file mode 100644 index 0000000..67dcd8e --- /dev/null +++ b/JS/IsPalindrom.js @@ -0,0 +1,9 @@ +//Name: Raza Mohayyuddin + +//Username: RazaKhan9639 + +//Approach:First we use toString method to convert integer to string Then we Convert the string in array by split("") method then reverse array Then join() to merge array. Than compare with original string and return. + +var isPalindrome = function (x) { + return x == x.toString().split("").reverse().join(""); +};