-
ArraysData TypesControl FlowBasic Language FeaturesFundamentals
Code function palindrome (x) { let result= x== x.split('').reverse().join(''); return result?'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:
-
Code - function palindrome (x) {
for (let i = 0; i < x.length/2; i++) {if (x[i] != x[x.length-i-1]) {return 'FALSE';}}return 'TRUE'- let result= x== x.split('').reverse().join('');
- return result?'TRUE':'FALSE';
- }
- 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 }}