Check for palindromes algorithm challenge. (question)

here is some of the code I tried in chrome’s console.,
I do not understand why the last line of code gave me that result.
could someone explain it to me?

backward is assigned to a function (not the returned value of the function). That’s what is being logged in your console.

syntax wise I thought backward and forward have the same syntax?

could you elaborate ?

or how should I change it?

Yes. And if you console.log(forward) it will look similar. You would have to call backward the same way that you do forward on line 3.

1 Like
console.log(backward("abc"));    // --> "cba"

console.log(backward);  // --> function(result){ return result.split('').reverse().join('');}
1 Like