javascript check if string ends with substring