Check if Palindrome

Check if a string is a palindrome by comparing characters from both ends.

Code

Algorithms
const clean = str.toLowerCase().replace(/[^a-z0-9]/g, '');
return clean === [...clean].reverse().join('');

Parameters

The string to check

Browser·fetch() may be limited by CORS

More JavaScript Snippets