MCPcopy Create free account
hub / github.com/codemistic/Web-Development / makeSound

Function makeSound

Drum kit Challenge/index.js:23–64  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

21});
22
23function makeSound(key) {
24
25 switch (key) {
26 case "w":
27 var tom1 = new Audio('sounds/tom-1.mp3');
28 tom1.play();
29 break;
30
31 case "a":
32 var tom2 = new Audio('sounds/tom-2.mp3');
33 tom2.play();
34 break;
35
36 case "s":
37 var tom3 = new Audio('sounds/tom-3.mp3');
38 tom3.play();
39 break;
40
41 case "d":
42 var tom4 = new Audio('sounds/tom-4.mp3');
43 tom4.play();
44 break;
45
46 case "j":
47 var snare = new Audio('sounds/snare.mp3');
48 snare.play();
49 break;
50
51 case "k":
52 var crash = new Audio('sounds/crash.mp3');
53 crash.play();
54 break;
55
56 case "l":
57 var kick = new Audio('sounds/kick-bass.mp3');
58 kick.play();
59 break;
60
61 default: console.log(drumInnerHTML);
62 break;
63 }
64}
65
66function buttonAnimation(currentKey) {
67

Callers 2

gotClickedFunction · 0.70
index.jsFile · 0.70

Calls 1

logMethod · 0.45

Tested by

no test coverage detected