Getting False on a recursive function with if conditions trying to solve the "Palindrome" Challenge

So I was doing this popular challenge "palindrome" and I was copying this solution from the "Frontend Masters" Javascript Series and I’m getting a different output. I want to know if there is something that changes or am I missing something. This is my first question on StackOverflow because this is just MindF***k.

What is going on?

'use strict'

function isPalindrome(str) {
  if (str.length <= 1) return true;
  var first = str[0];
  var last = str[str.length - 1];
  if (first === last) {
    console.log(str.substring(1, str.length - 1))
    isPalindrome(str.substring(1, str.length - 1));
  return false;

console.log(isPalindrome("abcdcba")) // Return false on my machine

I try this on the RunJS app as well as the VScode terminal and also I run Node on the file.


91 thoughts on “Getting False on a recursive function with if conditions trying to solve the "Palindrome" Challenge”

  1. What you composed made a bunch of sense. However,
    what about this? what if you were to create a awesome headline?
    I ain’t suggesting your content isn’t good, but what if you added something to maybe grab folk’s attention? I mean Getting False on a
    recursive function with if conditions trying to solve the "Palindrome" Challenge – JavaScript Help is
    kinda vanilla. You should look at Yahoo’s home page
    and note how they create post titles to get viewers
    to open the links. You might add a related video or a related pic or two to get readers excited about everything’ve got to say.
    In my opinion, it might make your posts a little
    bit more interesting.

  2. We’re a group of volunteers and opening a new scheme in our community.
    Your web site offered us with valuable information to work on. You’ve done an impressive job and our entire community will
    be thankful to you.

  3. Hi there! This post could not be written any better!
    Reading through this post reminds me of my previous roommate!
    He constantly kept talking about this. I am going to forward this article to him.

    Fairly certain he will have a good read. Thank you for sharing!

  4. Hey there would you mind stating which blog platform you’re working with?
    I’m planning to start my own blog in the near future but I’m
    having a tough time choosing between BlogEngine/Wordpress/B2evolution and
    Drupal. The reason I ask is because your layout seems different then most blogs and
    I’m looking for something unique. P.S My apologies for being
    off-topic but I had to ask!

  5. First off I want to say fantastic blog! I had a quick
    question that I’d like to ask if you don’t mind.
    I was interested to find out how you center yourself and clear your thoughts prior to writing.
    I’ve had a difficult time clearing my thoughts in getting my ideas out there.

    I truly do take pleasure in writing but it just seems
    like the first 10 to 15 minutes are wasted just trying to
    figure out how to begin. Any recommendations or hints?



Leave a Comment