JavaScript Algorithms and Data Structures Projects - Palindrome Checker

Need some help in figuring out what I’m doing wrong. Thanks!

Your code so far

function palindrome(str1,str2) {
let len1=str1.length
let len2=str2.length
return (len1!=len2)?"false"
:((str1.split('').sort().join('')===
str2.split('').sort().join(''))?"true"



};
palindrome("eye");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Challenge: JavaScript Algorithms and Data Structures Projects - Palindrome Checker

Link to the challenge:

Why do you have two parameters in your function?
The function is supposed to check whether or not a single string is palindromic.
You’re trying to perform actions on a second string, which doesn’t exist.

I would read the instructions again closely to make sure you understand how the tests expect you to check for a palindrome. Also, if you are having trouble then don’t try to optimize your code right now. Just focus on getting the function right first. Then you can go back and refactor to make it prettier if you like.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.