Typescript Last Character Javascript Interview