-
ArraysData TypesControl FlowBasic Language FeaturesFundamentals
Description Palindrome:
A palindrome is a word that when reversed reads the same. An example is "evil rats star live."
Valid palindromes should output 'TRUE' while invalid ones should output 'FALSE'.
Code function palindrome (x) { let s = x.split('').reverse().join('') return x == s ? "TRUE" : "FALSE" }
Preloaded Code function palindrome (x) { // code here }
Test Cases Test.assertEquals(palindrome('evil rats star live'), "TRUE"); Test.assertEquals(palindrome('Owu'), "FALSE"); Test.assertEquals(palindrome('level'), "TRUE"); Test.assertEquals(palindrome('uwu'), "TRUE"); Test.assertEquals(palindrome('stressed desserts'), "TRUE");
Output:
-
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}