Find an Index Value of a Substring in JavaScript