You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
604 B

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()