String Reverse Function In Typescript