MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/xosb9d/just_solved_a_palindrome_problem_with_recursion/iq2bal4/?context=3
r/learnjavascript • u/KayteeFly • Sep 26 '22
64 comments sorted by
View all comments
94
Congrats! How about this:
const isPalindrome = (string) => string === [...string].reverse().join('')
7 u/KayteeFly Sep 26 '22 That’s great! But the question was to solve it with recursion. 3 u/c2u5hed Sep 27 '22 As far as I can tell from the screenshot there is no requirement to do that with recursion. Even if there is and it’s off screen, isn't it good to also learn something new along the way? 5 u/KayteeFly Sep 27 '22 It’s a course I am taking and the question require you to solve it with recursion.
7
That’s great! But the question was to solve it with recursion.
3 u/c2u5hed Sep 27 '22 As far as I can tell from the screenshot there is no requirement to do that with recursion. Even if there is and it’s off screen, isn't it good to also learn something new along the way? 5 u/KayteeFly Sep 27 '22 It’s a course I am taking and the question require you to solve it with recursion.
3
As far as I can tell from the screenshot there is no requirement to do that with recursion. Even if there is and it’s off screen, isn't it good to also learn something new along the way?
5 u/KayteeFly Sep 27 '22 It’s a course I am taking and the question require you to solve it with recursion.
5
It’s a course I am taking and the question require you to solve it with recursion.
94
u/c2u5hed Sep 26 '22
Congrats! How about this:
const isPalindrome = (string) => string === [...string].reverse().join('')