From d76c55010b49aaae4f2f2c7d87cb431acb1bff70 Mon Sep 17 00:00:00 2001 From: Meet Zaveri Date: Tue, 12 Dec 2017 16:08:50 +0530 Subject: [PATCH] Create Check_for_palindrome.md --- snippets/Check_for_palindrome.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 snippets/Check_for_palindrome.md diff --git a/snippets/Check_for_palindrome.md b/snippets/Check_for_palindrome.md new file mode 100644 index 000000000..cc5a9267d --- /dev/null +++ b/snippets/Check_for_palindrome.md @@ -0,0 +1,10 @@ +### Check For Palindrome + +``` +function palindrome(str) { + var rg =/[\W_]/g; + var low_rep=str.toLowerCase().replace(rg,''); + var final= low_rep.split('').reverse().join(''); + return final == low_rep; + } + ```