const quiz = [
  {
    question: '今年は西暦何年？',
    answers: [ '2000', '2020', '2200', '20200'],
    correct: '2020'
  }, {
    question: 'サンタクロースの苗字は？',
    answers: [ '田中', '佐藤', 'トランプ', 'ない'],
    correct: 'ない'
  }, {
    question: '太陽までの距離は？',
    answers: [ '3km', '100m', '1000kg', '1億4960万km'],
    correct: '1億4960万km'
  }
];

const $window = window;
const $doc = document;
const $question = $doc.getElementById('js-question');
const $buttons = $doc.querySelectorAll('.btn');

const quizLen = quiz.length;
let quizCount = 0;
let score = 0;

const init = () => {
  $question.textContent = quiz[quizCount].question;
  
  const buttonLen = $buttons.length;
  let btnIndex = 0;
  
  while(btnIndex  {
  quizCount++;
  if(quizCount  {
  if(elm.textContent === quiz[quizCount].correct){
    $window.alert('正解!');
    score++;
  } else {
    $window.alert('不正解!');
  }
  goToNext();
};

const showEnd = () => {
  $question.textContent = '終了！あなたのスコアは' + score + '/' + quizLen + 'です';
  
  const $items = $doc.getElementById('js-items');
  $items.style.visibility = 'hidden';
};

init();

let answersIndex = 0;
let answersLen = quiz[quizCount].answers.length;

while(answersIndex  {
    judge(e.target);
  });
  answersIndex++;
}


