0
TypeError: undefined is not an object (evaluating 'answer[i].option[que.crt]')
function showYourAns() { $(".ans-list").html(""); $(".sc").text(score+ "/"+ques.length) ques.forEach((que,i) => { const li = document.createElement('li'); const p = document.createElement('p'); const span = document.createElement('span'); p.textContent = 1+i +" : "+ que.que; const chrt = que.crt == answer[i] ? '👉' : '❌'; span.textContent = chrt +" "+ que.option[answer[i].option[que.crt]]; const cls = que.crt == answer[i] ? 'green' : 'red'; span.classList.add(cls); li.appendChild(p) li.appendChild(span) $(".ans-list").append(li); }) }
1 Antwort
0
Save your code in SoloLearn, and share its link in place of the raw text partial code above. Partial code is harder to debug.
Here's how you can share your code link 👇
https://www.sololearn.com/post/75089/?ref=app