diff --git a/game.js b/game.js
index b374aed..c005678 100644
--- a/game.js
+++ b/game.js
@@ -220,36 +220,70 @@ function displayEndScreen() {
clearInterval(gameTimeIntervalId);
+ if (guessReverseFlag() || guessFlag()) {
+ incorrectAnswersTable.innerHTML = "
country | answer | your answer |
";
+ correctAnswersTable.innerHTML = " flag | country |
";
+ }
- state.incorrectAnswers.forEach(ans => {
- var tr = document.createElement('tr');
- console.log(ans)
+ if (guessReverseFlag()) {
+ state.incorrectAnswers.forEach(ans => {
+ var tr = document.createElement('tr');
+ console.log(ans)
- tr.appendChild(document.createElement('td'))
- tr.lastChild.innerHTML = ans.question.countryname
+ tr.appendChild(document.createElement('td'))
+ tr.lastChild.innerHTML = ans.question.countryname
- tr.appendChild(document.createElement('td'))
- if (guessFlag()) tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.answer.code);
- else tr.lastChild.innerHTML = ans.answer.answer;
+ tr.appendChild(document.createElement('td'))
+ tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.answer.code);
- tr.appendChild(document.createElement('td'))
- if (guessFlag()) tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.options[ans.userAnswer].code);
- else tr.lastChild.innerHTML = ans.options[ans.userAnswer].answer;
+ tr.appendChild(document.createElement('td'))
+ tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.options[ans.userAnswer].code);
- incorrectAnswersTable.appendChild(tr);
- })
- if (state.incorrectAnswers.length <= 0)
- incorrectAnswersTable.innerHTML = "no incorrect answers! go you!";
+ incorrectAnswersTable.appendChild(tr);
+ })
+ if (state.incorrectAnswers.length <= 0)
+ incorrectAnswersTable.innerHTML = "no incorrect answers! go you!";
- state.correctAnswers.forEach(ans => {
- var tr = document.createElement('tr');
- tr.appendChild(document.createElement('td'))
- tr.lastChild.innerHTML = ans.question.countryname
- tr.appendChild(document.createElement('td'))
- if (guessFlag()) tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.answer.code);
- else tr.lastChild.innerHTML = ans.answer.answer;
- correctAnswersTable.appendChild(tr);
- })
+ state.correctAnswers.forEach(ans => {
+ var tr = document.createElement('tr');
+ tr.appendChild(document.createElement('td'))
+ tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.question.code);
+ tr.appendChild(document.createElement('td'))
+ tr.lastChild.innerHTML = ans.answer.countryname;
+ correctAnswersTable.appendChild(tr);
+ })
+ } else {
+ state.incorrectAnswers.forEach(ans => {
+ var tr = document.createElement('tr');
+ console.log(ans)
+
+ tr.appendChild(document.createElement('td'))
+ if (guessCountry()) tr.lastChild.innerHTML = ans.question.capital
+ else tr.lastChild.innerHTML = ans.question.countryname
+
+ tr.appendChild(document.createElement('td'))
+ if (guessFlag()) tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.answer.code);
+ else tr.lastChild.innerHTML = ans.answer.answer;
+
+ tr.appendChild(document.createElement('td'))
+ if (guessFlag()) tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.options[ans.userAnswer].code);
+ else tr.lastChild.innerHTML = ans.options[ans.userAnswer].answer;
+
+ incorrectAnswersTable.appendChild(tr);
+ })
+ if (state.incorrectAnswers.length <= 0)
+ incorrectAnswersTable.innerHTML = "no incorrect answers! go you!";
+
+ state.correctAnswers.forEach(ans => {
+ var tr = document.createElement('tr');
+ tr.appendChild(document.createElement('td'))
+ tr.lastChild.innerHTML = ans.question.countryname
+ tr.appendChild(document.createElement('td'))
+ if (guessFlag()) tr.lastChild.innerHTML = getImageURLFromCountryCode(ans.answer.code);
+ else tr.lastChild.innerHTML = ans.answer.capital;
+ correctAnswersTable.appendChild(tr);
+ })
+ }
if (state.correctAnswers.length <= 0)
correctAnswersTable.innerHTML = "no correct answers. better luck next time :')";