title: index.js:33 Uncaught TypeError: Cannot read property 'question' of undefined at loadQuiz (index.js:33)
body: <p>Having a small problem in index.js file. Next question should come up when submit button is clicked. but instead this error is showing up...</p>
  <blockquote>
  <p>index.js:33 Uncaught TypeError: Cannot read property 'question' of undefined
  at loadQuiz (index.js:33)
  at HTMLButtonElement. (index.js:43)</p>
  </blockquote>
  <p>Use snippet to view the result</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const quizContent = [{
    question: "What is the most used programming language ?",
    a: "Java",
    b: "Python",
    c: "C",
    d: "C++",
    answer: "a"
  }, {
    question: "How much time is required to become a Web Developer?",
    a: "1 month",
    b: "2 month",
    c: "3 month",
    d: "4 month",
    answer: "d"
  
  }];
  
  const questionEl = document.getElementById("question");
  const a_text = document.getElementById("a_text");
  const b_text = document.getElementById("b_text");
  const c_text = document.getElementById("c_text");
  const d_text = document.getElementById("d_text");
  const submitButton = document.getElementById("submit");
  
  let currentQuiz = 0;
  loadQuiz();
  
  function loadQuiz() {
    const currentQuizContent = quizContent[currentQuiz];
  
    questionEl.innerText = currentQuizContent.question;
    a_text.innerText = currentQuizContent.a;
    b_text.innerText = currentQuizContent.b;
    c_text.innerText = currentQuizContent.c;
    d_text.innerText = currentQuizContent.d;
  
    currentQuiz++;
  }
  submitButton.addEventListener("click", () =&gt; {
    currentQuiz++;
    loadQuiz();
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    font-family: 'Secular One', sans-serif;
    background: #bbd2c5;
    /* fallback for old browsers */
    background: -webkit-linear-gradient( to bottom, #292e49, #536976, #bbd2c5);
    /* Chrome 10-25, Safari 5.1-6 */
    background: linear-gradient( to bottom, #292e49, #536976, #bbd2c5);
    /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .container-quiz {
    background-color: white;
    display: flex;
    flex-direction: column;
    width: 33%;
    padding-top: 20px;
    border-radius: 6px;
    overflow: hidden;
  }
  
  h2 {
    text-align: center;
  }
  
  .container-quiz li {
    padding: 6px;
  }
  
  ul {
    list-style-type: none;
  }
  
  button {
    height: 3rem;
    display: block;
    width: 100%;
    border: none;
    color: white;
    font-size: 1rem;
    background-color: #4370e7;
    cursor: pointer;
  }
  
  button:hover {
    background-color: #3259c5;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    &lt;title&gt;Document&lt;/title&gt;
    &lt;link rel="stylesheet" href="style.css"&gt;
    &lt;link href="https://fonts.googleapis.com/css2?family=Secular+One&amp;display=swap" rel="stylesheet"&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;div class="container-quiz"&gt;
      &lt;div&gt;
        &lt;h2 id="question"&gt;Question&lt;/h2&gt;
        &lt;ul&gt;
          &lt;li&gt;
            &lt;input type="radio" name="answer" id="a"&gt;
            &lt;label id="a_text" for="a"&gt;Question Text&lt;/label&gt;
          &lt;/li&gt;
          &lt;li&gt;
            &lt;input type="radio" name="answer" id="b"&gt;
            &lt;label id="b_text" for="a"&gt;Question Text&lt;/label&gt;
          &lt;/li&gt;
          &lt;li&gt;
            &lt;input type="radio" name="answer" id="c"&gt;
            &lt;label id="c_text" for="c"&gt;Question Text&lt;/label&gt;
          &lt;/li&gt;
          &lt;li&gt;
            &lt;input type="radio" name="answer" id="d"&gt;
            &lt;label id="d_text" for="d"&gt;Question Text&lt;/label&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
        &lt;button id="submit"&gt;Submit&lt;/button&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;script src="index.js"&gt;&lt;/script&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>