Cannot Index String Javascript Substring Indexof