JavaScript/02-isPalindrome.js
// returns true if palindrome(reads the same for/backward), otherwise false
returns true if palindrome(reads the same for/backward), otherwise false
returns true if palindrome ( reads the same for / backward ) otherwise false
function isPalindrome(str) {
  let result = [];
  function helper(helperStr) {
    let leng = helperStr.length;
    let first = helperStr[0];
    let last = helperStr[leng - 1];
    if (leng === 0) return; 
    first === last ? result.push(true) : result.push(false);
    helper(helperStr.slice(1, leng - 1)); 
  }
  helper(str);
  return result.every((el) => el); 
}
function isPalindrome ( str ) { let result = [ ] ; function helper ( helperStr ) { let leng = helperStr . length ; let first = helperStr [ 0 ] ; let last = helperStr [ leng - 1 ] ; if ( leng === 0 ) return ; first === last ? result . push ( true ) : result . push ( false ) ; helper ( helperStr . slice ( 1 , leng - 1 ) ) ; } helper ( str ) ; return result . every ( ( el ) => el ) ; }
returns true if palindrome(reads the same for/backward), otherwise false
returns true if palindrome ( reads the same for / backward ) otherwise false
// base case // console.log(first, last, result); // recur // when every elements is true, return true