javascript function to check if string contains substring