Check If Char Exists In String Javascript Substring Notation