Easy javascript

Check palindrome

Problem

Return whether "madam" is a palindrome.

Hints
  • split, reverse, join and compare to original

Your practice code

Ready — edit the code above and click Run.

Solution

const s = "madam";
const ok = s === s.split("").reverse().join("");
console.log(ok);

Try solving on your own first, then reveal the official answer.

Explanation

Compare string to its reverse. For production, use two-pointer for O(1) space.

Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details