Typescript Last Character Javascript Interview Bit