JS Learning

Check Palindrome

easy

Topic Overview

Take your time to understand each concept. Practice with the examples below!

A palindrome is a word that reads the same forwards and backwards. Let's build a function to detect them!

Your Task:

Create a function that checks if a given string is a palindrome. The function should return true if it is, and false otherwise.

Examples:

  • "racecar" → true (reads the same both ways)
  • "hello" → false (olleh ≠ hello)
  • "madam" → true
  • "A man a plan a canal Panama" → Consider case and spaces!

What You'll Learn:

  • String comparison techniques
  • How to handle case sensitivity
  • Working with string methods
  • Logical thinking and algorithm design

Challenge Yourself:

Can you make it work with phrases that have spaces and punctuation?

Ready to practice? Try the exercise below to reinforce your learning!

JAVASCRIPT Editor
Loading...