interview questions

Checking if String is a Palindrome with JavaScript

A palindrome is a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction. It is not uncommon to be asked to write a JavaScript function that checks if a string is a palindrome on front-end developer position interview.

Here’s one possible solution, utilizing a few JavaScript array methods (split(), reverse() and join()). Of course, if you don’t want to get that sophisticated, a simple one-line solution can be easily extracted from the class.

Merry Christmas! Find more front-end experiments and insight here.

Related Posts and Links