0
[SOLVED] Problem palindrome exercise
Hi, it's the first time that I post something here and i'm sorry for eventual mistakes. I have a problem with this code. I have to check if the user word is a palindrome but i don't know where is the error. Thank you to everyone https://code.sololearn.com/WkO05PjnwLWU/?ref=app
13 odpowiedzi
+ 2
https://code.sololearn.com/WvjU9061g2rC/?ref=app
+ 1
Jayne Clifford-Greening yeeeeah, thanks for telling me!!! Finally it worked :) :)
+ 1
Ghost11 - you're welcome. Well done. Jayne 🐱
+ 1
Mwikisa Delton Kapesa Lufungulo thank you, in this way i learned another method
0
Ghost11 we are happy to help you but you have not yet understood that Java and JavaScript are two different languages. You have written JS code in Java.
That's really a significant mistake and I would like you to do some research and get back on the right track.
0
Hi, thank you, I included the code and I forgot to write that the code is javascript
0
Ghost11 you can write the code in web. It's on the top when you select a language to write your code. It has a JS section where you can put that code and test it. If you still find difficulty, you can come back with your code.
0
Avinesh Thanky you, I rectified the code in the answer.
0
you must start your loop at index = user_word.length-1 (for n length string, indexes start at 0 and end at n-1 ^^)
for (var i = user_word.length-1; i >= 0 ; i--)
You could have debugged it by yourself, just by adding a console.log of the result variable (wich was outputing "undefinedanna" before the fix ;))
0
visph thank you, I was going crazy to solve this exercise. You saved my mind :) :)
0
Hi, I entered the name Hannah and the result told me it was a palindrome! Jayne 🐱
0
I also entered the name Julie and was told it wasn't a palindrome! Jayne 🐱
0
Ghost11 You are welcome