Skip to content

Commit 54a63d9

Browse files
authored
Create is-palindrome.js
1 parent 83f1105 commit 54a63d9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

is-palindrome.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const isPalindrome = input => {
2+
const inputLength = input.length;
3+
if (!inputLength) {
4+
return true;
5+
}
6+
if (input[0] !== input[inputLength - 1]) {
7+
return false;
8+
}
9+
return isPalindrome(input.slice(1, inputLength - 1));
10+
};
11+
12+
const input = "madam";
13+
console.log(isPalindrome(input.toLowerCase()));

0 commit comments

Comments
 (0)