// FUNCTION IMPLEMENTATION (MULTIPLE BUGS)
const isPalindrome = (str:string):boolean => {
  const noSpaces:string = str.toLowerCase().split(" ").join("");
  const midIndex:number = Math.floor(noSpaces.length/2);
  const lastIndex:number = noSpaces.length - 1;

  for (let i = 0; i < midIndex; i++) {
    if (noSpaces[i] !== noSpaces[lastIndex - i]) return false;
  }
  return true;
}

export default isPalindrome;