A palindrome is a string that reads the same forwards and backwards: "racecar", "level", "abba". Implement stringPalindrome(str) — return true if the input reads the same in both directions, false otherwise.
Treat the comparison as strict: case matters and every character counts. "Racecar" is not a palindrome (capital R differs from lowercase r), and "race car" is not a palindrome (the space at index 4 differs from the e at the mirror position). If the caller wants to normalize, they can do it before calling you.
function stringPalindrome(str) {
// returns true if str reads the same forwards and backwards,
// false otherwise.
}
stringPalindrome('racecar'); // true
stringPalindrome('level'); // true
stringPalindrome('hello'); // false
stringPalindrome(''); // true — empty string is trivially a palindrome
stringPalindrome('a'); // true — single char mirrors itself
stringPalindrome('Racecar'); // false — case-sensitive
stringPalindrome('race car'); // false — whitespace is significant
true. There is nothing to mismatch.true. It is its own mirror.'A' !== 'a'. Do not lowercase the input.' ' is just another character.