Typescript Features Over Javascript Substring Function In Cpp