Return whether "madam" is a palindrome.
Ready — edit the code above and click Run.
const s = "madam";
const ok = s === s.split("").reverse().join("");
console.log(ok);
Try solving on your own first, then reveal the official answer.
Compare string to its reverse. For production, use two-pointer for O(1) space.