EXERCISE · AlgoCasts

Palindrome

Given a string, return true if the string is a palindrome or false if it is not. Palindromes are strings that form the same word if it is reversed.

8 testsAlgoCastsGPL-3.01 alternateexercise 02 of 26

Directions

Directions

Given a string, return true if the string is a palindrome or false if it is not. Palindromes are strings that form the same word if it is reversed. *Do* include spaces and punctuation in determining if the string is a palindrome.

Examples#

JS
palindrome("abba") === truepalindrome("abcdefg") === false

Try it first#

Copy the stub, make the 8 tests pass on your machine, then open the solution. The reveal is remembered per page in this browser.

JSexercises/palindrome/index.js
function palindrome(str) {} module.exports = palindrome;

See also