-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
48 lines (39 loc) · 1.33 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Array.prototype.choice = function() {
var i = Math.floor(Math.random() * this.length);
return this[i];
}
const h1 = document.getElementById('trashgoeshere');
note = ['A', 'B', 'C', 'D', 'E', 'F', 'G']
accidental = ['#', '♭', '']
thirdfifth = ['min', 'maj', 'dim', 'aug']
seventh = ['maj7', 'min7']
sussybois = ['sus2', 'sus4']
inv = ['a', 'b', 'c', 'd']
// n = note[Math.floor(Math.random()*note.length)]
// tf = thirdfifth[Math.floor(Math.random()*thirdfifth.length)]
// sev = seventh[Math.floor(Math.random()*seventh.length)]
// sus = sussybois[Math.floor(Math.random()*sussybois.length)]
// invert = inv[Math.floor(Math.random()*inv.length)]
// acc = accidental[Math.floor(Math.random()*accidental.length)]
n = note.choice()
tf = thirdfifth.choice()
sev = seventh.choice()
sus = sussybois.choice()
invert = inv.choice()
acc = accidental.choice()
// console.log(n+tf+invert);
coinflip = Math.floor(Math.random()*3);
// console.log(coinflip);
if(!coinflip){
// seventh chord chosen
h1.innerHTML = `${n}${acc}<span>${tf}</span>${sev}<span>${invert}</span>`;
}
else if(coinflip == 1){
h1.innerHTML = `${n}${acc}<span>${tf}</span>${invert}`;
}
else{
// a sus chord
h1.innerHTML = `${n}${acc}<span>${sus}</span>${invert}`;
}
// console.log(n+tf+sev);
// console.log('what hte heck?');