11 lines
286 B
JavaScript
11 lines
286 B
JavaScript
// Reverses a string.
|
|
function reverse(string) {
|
|
return Array.from(string).reverse().join("")
|
|
}
|
|
|
|
// Returns true for a palindrome, false otherwise.
|
|
function palindrome(string) {
|
|
let processedContent = string.toLowerCase();
|
|
return processedContent === reverse(processedContent);
|
|
}
|