Вот так правильнее
const sToImg = (s) => {
return (s.length<2? `<img src="img/0.jpg" alt="0">`: `<img src="img/${s[0]}.jpg" alt="${s[0]}">`) + `<img src="img/${s[s.length-1]}.jpg" alt="${s[s.length-1]}">`;
}
const [sh, sm, ss] = document.getElementById("CountdownM").innerHTML.split(':');
document.getElementById("CountdownM").innerHTML = sToImg(sh) + ':' + sToImg(sm)+ ':' + sToImg(ss);