Playing a sound to match something in an array

Hello.

I’m creating a matching game with letters. I would like the sound to play with the associated letter so that the user can hear how it’s pronounced correctly when they click on the image.

Here is the function I’m having difficulty with. After the program identifies which image has been selected I would like it to play the corresponding sound with it.


function showImg(x){
  if (clickCount >= 2) checkAns();
  pics[clickCount] = x;
  clickCount +=1;
  document.getElementById(x).src="pics/pic"+thePics[x]+".jpg";
  //document.getElementById(x).innerHTML= "<embed src=\sounds\sound"+x+".mp3\" hidden=\"true\" autostart=\"true\" loop=\"false\" />";
  alert(x);
 }
 
 

Here is an example of my table of cards:


<table align="center">
<tr>
<td><img id="0" src="pics/backCard.jpg" width="100" height="120" alt="1" onclick="showImg(0);" /></td>
 
</table>