let wordToGuess = ''
let playerAttempt = ''
const startBtn = document.getElementsByClassName('start-btn')[0]
const resetBtn = document.getElementsByClassName('reset-btn')[0]
// Grab the div to hold the keyboard
const playerKeyboard = document.getElementsByClassName('player-keyboard')[0]
const blanksDisplayBox = document.getElementsByClassName('blanks-display-box')[0]
// Create variables for unicode a and z
const unicodeA = 97
const unicodeZ = 122
// Write a function to create the keyboard and call it
function createKeyboard() {
for (let i = unicodeA; i <= unicodeZ; i++) {
const character = String.fromCharCode(i)
const letterButton = document.createElement('button')
letterButton.className = 'letter-btn'
letterButton.setAttribute('id', character)
letterButton.innerText = character
letterButton.addEventListener('click', handleGuess)
playerKeyboard.appendChild(letterButton)
}
}
createKeyboard()
//http://random-word-api.herokuapp.com/home
function handleStart(){
const url = 'https://random-word-api.herokuapp.com/word?number=1&swear=0'
fetch(url)
.then(response => response.json())
.then(data => {
wordToGuess = data.toString()
console.log(wordToGuess)
for (let i =0; i<wordToGuess.length; i++){
playerAttempt += '-'
}
blanksDisplayBox.innerText = playerAttempt
})
}
function handleGuess(){
}