function playerName() {
  var inputName = document.createElement("input");
  inputName.className = "input";
  var btn = document.createElement("BUTTON")
  btn.className = "btn";
  btn.innerHTML = "Submit!";

  //local storage of name and high score
  var highScore = JSON.parse(localStorage.getItem("highScore")) || [];
  btn.addEventListener("click", function (event) {
    console.log(inputName.value);
    var newScore = { score: correctCount, initials: inputName.value };
    highScore.push(newScore);
    localStorage.setItem("highScore", JSON.stringify(highScore));
  });

  inputName.setAttribute("type", "text");
  document.body.appendChild(inputName);
  document.body.appendChild(btn);

}
//player enters name at end of quiz
player enters name at end of quiz
player enters name at end of quiz
function playerName() {
  var inputName = document.createElement("input");
  inputName.className = "input";
  var btn = document.createElement("BUTTON")
  btn.className = "btn";
  btn.innerHTML = "Submit!";
  var highScore = JSON.parse(localStorage.getItem("highScore")) || [];
  btn.addEventListener("click", function (event) {
    console.log(inputName.value);
    var newScore = { score: correctCount, initials: inputName.value };
    highScore.push(newScore);
    localStorage.setItem("highScore", JSON.stringify(highScore));
  });
  inputName.setAttribute("type", "text");
  document.body.appendChild(inputName);
  document.body.appendChild(btn);
}
function playerName ( ) { var inputName = document . createElement ( "input" ) ; inputName . className = "input" ; var btn = document . createElement ( "BUTTON" ) btn . className = "btn" ; btn . innerHTML = "Submit!" ; var highScore = JSON . parse ( localStorage . getItem ( "highScore" ) ) || [ ] ; btn . addEventListener ( "click" , function ( event ) { console . log ( inputName . value ) ; var newScore = { score : correctCount , initials : inputName . value } ; highScore . push ( newScore ) ; localStorage . setItem ( "highScore" , JSON . stringify ( highScore ) ) ; } ) ; inputName . setAttribute ( "type" , "text" ) ; document . body . appendChild ( inputName ) ; document . body . appendChild ( btn ) ; }
player enters name at end of quiz
player enters name at end of quiz
//local storage of name and high score