Ad
Arrays
Data Types
Control Flow
Basic Language Features
Fundamentals
Code
Diff
  • function palindrome (x) {
      let result= x== x.split('').reverse().join('');
      return result?'TRUE':'FALSE';
    }
    • 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';
    • }