mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
Remove live code & console.log, leave examples as comments (ProjectEuler, Recursive).
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
|
||||
// Check whether the given string is Palindrome or not
|
||||
const Palindrome = (str) => {
|
||||
export const Palindrome = (str) => {
|
||||
if (typeof str !== 'string') {
|
||||
str = str.toString()
|
||||
}
|
||||
@ -18,13 +18,4 @@ const Palindrome = (str) => {
|
||||
} else {
|
||||
return Palindrome(str.slice(1, str.length - 1))
|
||||
}
|
||||
};
|
||||
|
||||
// testing
|
||||
(() => {
|
||||
console.log('Palindrome: String: a = ', Palindrome('a'))
|
||||
console.log('Palindrome: String: abba = ', Palindrome('abba'))
|
||||
console.log('Palindrome: String: ababa = ', Palindrome('ababa'))
|
||||
console.log('Not Palindrome: String: abbxa = ', Palindrome('abbxa'))
|
||||
console.log('Not Palindrome: String: abxa = ', Palindrome('abxa'))
|
||||
})()
|
||||
}
|
||||
|
Reference in New Issue
Block a user