Create Check_for_palindrome.md
This commit is contained in:
10
snippets/Check_for_palindrome.md
Normal file
10
snippets/Check_for_palindrome.md
Normal file
@ -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;
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user