(e)
| 13 | } |
| 14 | |
| 15 | function playSound(e) { |
| 16 | const audio = document.querySelector(`audio[data-key="${e.keyCode}"]`); |
| 17 | const key = document.querySelector(`div[data-key="${e.keyCode}"]`); |
| 18 | if (!audio) return; |
| 19 | |
| 20 | key.classList.add('playing'); //changing the class of key div |
| 21 | audio.currentTime = 0; // it starts the music before the end of previous music |
| 22 | audio.play(); |
| 23 | } |
| 24 | |
| 25 | // the e represents event , here the key of keyboard keyCode is the property of event e |
| 26 |
nothing calls this directly
no outgoing calls
no test coverage detected