UNPKG

cpt-waffle-lotide

Version:
14 lines (13 loc) 444 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const isPalindrome = (str) => { const noSpaces = str.toLowerCase().split(" ").join(""); const midIndex = Math.floor(noSpaces.length / 2); const lastIndex = noSpaces.length - 1; for (let i = 0; i < midIndex; i++) { if (noSpaces[i] !== noSpaces[lastIndex - i]) return false; } return true; }; exports.default = isPalindrome;