check whether a string contains a substring in JavaScript