Typescript Last Character Javascript Interviewbit