display random tone value

master
Matthew Huntington 1 year ago
parent ba1d995e3a
commit d772fe806e

@ -1 +1,12 @@
console.log('hi'); const lowest = 27.5
const highest = 4186
const range = highest - lowest
const generateButton = document.querySelector('body > button')
const toneDisplay = document.querySelector('section dd')
let newTone
generateButton.addEventListener('click', () => {
newTone = Math.random() * range + lowest
toneDisplay.innerHTML = newTone
})

@ -3,10 +3,18 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title></title> <title></title>
<script src="app.js"></script> <script src="app.js" defer></script>
</head> </head>
<body> <body>
<h1>Tuner</h1> <h1>Tuner</h1>
<button>Generate Tone</button>
<section>
<dl>
<dt>Tone:</dt>
<dd></dd>
</dl>
<button>Play</button>
<button>Stop</button>
</section>
</body> </body>
</html> </html>

Loading…
Cancel
Save