function solution1(str: string, ending: string): boolean {
  if (ending === "") return true;
  const startIndex = str.length - ending.length;
  const subStr = str.substring(startIndex);
  return subStr === ending;
}

export function bestSolution(str: string, ending: string): boolean {
  return str.endsWith(ending);
}

console.log(solution1("abcde", "cde"), true);
console.log(solution1("abcde", "abs"), false);
console.log(solution1("abcde", ""), true);
