From f3ed6a19e73066736f5a98ad48dcc26ae1ff5ca6 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Sun, 29 Oct 2023 16:38:15 -0400 Subject: [PATCH] all the hame --- app.js | 42 ++++++++++++++++++++++++++++++++++++++++++ index.html | 15 +++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 app.js create mode 100644 index.html diff --git a/app.js b/app.js new file mode 100644 index 0000000..1c53830 --- /dev/null +++ b/app.js @@ -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() diff --git a/index.html b/index.html new file mode 100644 index 0000000..900d9a1 --- /dev/null +++ b/index.html @@ -0,0 +1,15 @@ + + + + + + + + + +