Js Count Characters In String Javascript Substring From Right