Still
July 1, 2022, 2:27pm
1
what is missing to complete this exercise? Thanks
function palindrome(str) {
str = str.toLowerCase().replace(/[\W_]/g, '');
for (var i = 0, len = str.length - 1; i <len/2; i ++) {
if (str [len - 1]) {
return true;
}
}
return false;
}
palindrome("eye");
**Your browser information:**
User Agent is: Mozilla/5.0 (Linux; Android 6.0.1; P01T_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36 (Ecosia android@101.0.4951.41)
Challenge: Palindrome Checker
Link to the challenge:
ILM
July 1, 2022, 2:53pm
2
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
ILM
July 1, 2022, 2:54pm
3
What are you checking with this?
Still
July 4, 2022, 5:01pm
4
if (str [len-i]) { return true; } et cetera How can I turn into the same case (Lower or uppercase)?
I don’t understand what you want str [len-i]
to do though.
system
Closed
January 3, 2023, 5:06am
6
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.