MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / playSoundsForKey

Function playSoundsForKey

assets/js/Xylophone.js:12–45  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

10}
11
12function playSoundsForKey(key) {
13 switch (key) {
14 case '1':
15 var note1 = new Audio('../assets/sounds/note1.wav')
16 note1.play()
17 break
18 case '2':
19 var note2 = new Audio('../assets/sounds/note2.wav')
20 note2.play()
21 break
22 case '3':
23 var note3 = new Audio('../assets/sounds/note3.wav')
24 note3.play()
25 break
26 case '4':
27 var note4 = new Audio('../assets/sounds/note4.wav')
28 note4.play()
29 break
30 case '5':
31 var note5 = new Audio('../assets/sounds/note5.wav')
32 note5.play()
33 break
34 case '6':
35 var note6 = new Audio('../assets/sounds/note6.wav')
36 note6.play()
37 break
38 case '7':
39 var note7 = new Audio('../assets/sounds/note7.wav')
40 note7.play()
41 break
42 default:
43 console.log(key)
44 }
45}
46
47function buttonAnimation(key) {
48 var activeButton = document.getElementById(key)

Callers 1

Xylophone.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected