parent
4fe9e55ca9
commit
f3ed6a19e7
@ -0,0 +1,42 @@
|
|||||||
|
const notes = [
|
||||||
|
'Ab',
|
||||||
|
'A',
|
||||||
|
'A#',
|
||||||
|
|
||||||
|
'Bb',
|
||||||
|
'B',
|
||||||
|
|
||||||
|
'C',
|
||||||
|
'C#',
|
||||||
|
|
||||||
|
'Db',
|
||||||
|
'D',
|
||||||
|
'D#',
|
||||||
|
|
||||||
|
'Eb',
|
||||||
|
'E',
|
||||||
|
|
||||||
|
'F',
|
||||||
|
'F#',
|
||||||
|
|
||||||
|
'Gb',
|
||||||
|
'G',
|
||||||
|
'G#',
|
||||||
|
]
|
||||||
|
|
||||||
|
const directions = ['↑', '↓']
|
||||||
|
const intervals = ['m6', 'M6']
|
||||||
|
|
||||||
|
const getRandomIndex = (arrayParam)=>{
|
||||||
|
return Math.floor((Math.random()*arrayParam.length))
|
||||||
|
}
|
||||||
|
|
||||||
|
const generateQuestion = ()=>{
|
||||||
|
const note = notes[getRandomIndex(notes)]
|
||||||
|
const direction = directions[getRandomIndex(directions)]
|
||||||
|
const interval = intervals[getRandomIndex(intervals)]
|
||||||
|
|
||||||
|
return `${note} ${direction} ${interval}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector('body').innerHTML = generateQuestion()
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title></title>
|
||||||
|
<script defer src="app.js"></script>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
text-align:center;
|
||||||
|
font-size: 25vw;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body></body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in new issue