Check for palindromes algorithm challenge. (question)

Check for palindromes algorithm challenge. (question)
0

#1

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?


#2

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


#3

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

could you elaborate ?

or how should I change it?


#4

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.


#5
console.log(backward("abc"));    // --> "cba"

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