From f5dc5099132e2ad7f366c87011e5eaad2d743823 Mon Sep 17 00:00:00 2001 From: Ololade <49575651+lolyparty@users.noreply.github.com> Date: Wed, 27 May 2020 01:18:12 +0100 Subject: [PATCH 1/3] Update Readme.md Correction of grammatical error --- ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index 4202d0d..25b1f26 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -48,7 +48,7 @@ In this video, we will create the Game Page and display static question and answ ## 3. Display Hard Coded Question and Answers -In this video, we will load questions from a hard coded array and iterate through available questions as the use answers them. We will use custom data attributes, the ES6 spread operator, and JavaScript arrow functions. +In this video, we will load questions from a hard coded array and iterate through available questions as the user answers them. We will use custom data attributes, the ES6 spread operator, and JavaScript arrow functions. Resources From 0fd212ed900899bcb325d6c69e1bcc1ed68c1487 Mon Sep 17 00:00:00 2001 From: James Quick Date: Thu, 11 Jun 2020 11:22:21 -0500 Subject: [PATCH 2/3] Using real values for score instead of dummy data --- .../end.js | 38 +++++++++---------- .../end.js | 38 +++++++++---------- 12. Create a Spinning Loader/end.js | 38 +++++++++---------- 8. Save High Scores in Local Storage/end.js | 38 +++++++++---------- .../end.js | 38 +++++++++---------- Quiz App Master/end.js | 38 +++++++++---------- 6 files changed, 114 insertions(+), 114 deletions(-) diff --git a/10. Fetch Questions from Local JSON File/end.js b/10. Fetch Questions from Local JSON File/end.js index e8eda3a..8e417b1 100644 --- a/10. Fetch Questions from Local JSON File/end.js +++ b/10. Fetch Questions from Local JSON File/end.js @@ -1,30 +1,30 @@ -const username = document.getElementById("username"); -const saveScoreBtn = document.getElementById("saveScoreBtn"); -const finalScore = document.getElementById("finalScore"); -const mostRecentScore = localStorage.getItem("mostRecentScore"); +const username = document.getElementById('username'); +const saveScoreBtn = document.getElementById('saveScoreBtn'); +const finalScore = document.getElementById('finalScore'); +const mostRecentScore = localStorage.getItem('mostRecentScore'); -const highScores = JSON.parse(localStorage.getItem("highScores")) || []; +const highScores = JSON.parse(localStorage.getItem('highScores')) || []; const MAX_HIGH_SCORES = 5; finalScore.innerText = mostRecentScore; -username.addEventListener("keyup", () => { - saveScoreBtn.disabled = !username.value; +username.addEventListener('keyup', () => { + saveScoreBtn.disabled = !username.value; }); -saveHighScore = e => { - console.log("clicked the save button!"); - e.preventDefault(); +saveHighScore = (e) => { + console.log('clicked the save button!'); + e.preventDefault(); - const score = { - score: Math.floor(Math.random() * 100), - name: username.value - }; - highScores.push(score); - highScores.sort((a, b) => b.score - a.score); - highScores.splice(5); + const score = { + score: mostRecentScore, + name: username.value, + }; + highScores.push(score); + highScores.sort((a, b) => b.score - a.score); + highScores.splice(5); - localStorage.setItem("highScores", JSON.stringify(highScores)); - window.location.assign("/"); + localStorage.setItem('highScores', JSON.stringify(highScores)); + window.location.assign('/'); }; diff --git a/11. Fetch API Questions from Open Trivia API/end.js b/11. Fetch API Questions from Open Trivia API/end.js index e8eda3a..8e417b1 100644 --- a/11. Fetch API Questions from Open Trivia API/end.js +++ b/11. Fetch API Questions from Open Trivia API/end.js @@ -1,30 +1,30 @@ -const username = document.getElementById("username"); -const saveScoreBtn = document.getElementById("saveScoreBtn"); -const finalScore = document.getElementById("finalScore"); -const mostRecentScore = localStorage.getItem("mostRecentScore"); +const username = document.getElementById('username'); +const saveScoreBtn = document.getElementById('saveScoreBtn'); +const finalScore = document.getElementById('finalScore'); +const mostRecentScore = localStorage.getItem('mostRecentScore'); -const highScores = JSON.parse(localStorage.getItem("highScores")) || []; +const highScores = JSON.parse(localStorage.getItem('highScores')) || []; const MAX_HIGH_SCORES = 5; finalScore.innerText = mostRecentScore; -username.addEventListener("keyup", () => { - saveScoreBtn.disabled = !username.value; +username.addEventListener('keyup', () => { + saveScoreBtn.disabled = !username.value; }); -saveHighScore = e => { - console.log("clicked the save button!"); - e.preventDefault(); +saveHighScore = (e) => { + console.log('clicked the save button!'); + e.preventDefault(); - const score = { - score: Math.floor(Math.random() * 100), - name: username.value - }; - highScores.push(score); - highScores.sort((a, b) => b.score - a.score); - highScores.splice(5); + const score = { + score: mostRecentScore, + name: username.value, + }; + highScores.push(score); + highScores.sort((a, b) => b.score - a.score); + highScores.splice(5); - localStorage.setItem("highScores", JSON.stringify(highScores)); - window.location.assign("/"); + localStorage.setItem('highScores', JSON.stringify(highScores)); + window.location.assign('/'); }; diff --git a/12. Create a Spinning Loader/end.js b/12. Create a Spinning Loader/end.js index e8eda3a..8e417b1 100644 --- a/12. Create a Spinning Loader/end.js +++ b/12. Create a Spinning Loader/end.js @@ -1,30 +1,30 @@ -const username = document.getElementById("username"); -const saveScoreBtn = document.getElementById("saveScoreBtn"); -const finalScore = document.getElementById("finalScore"); -const mostRecentScore = localStorage.getItem("mostRecentScore"); +const username = document.getElementById('username'); +const saveScoreBtn = document.getElementById('saveScoreBtn'); +const finalScore = document.getElementById('finalScore'); +const mostRecentScore = localStorage.getItem('mostRecentScore'); -const highScores = JSON.parse(localStorage.getItem("highScores")) || []; +const highScores = JSON.parse(localStorage.getItem('highScores')) || []; const MAX_HIGH_SCORES = 5; finalScore.innerText = mostRecentScore; -username.addEventListener("keyup", () => { - saveScoreBtn.disabled = !username.value; +username.addEventListener('keyup', () => { + saveScoreBtn.disabled = !username.value; }); -saveHighScore = e => { - console.log("clicked the save button!"); - e.preventDefault(); +saveHighScore = (e) => { + console.log('clicked the save button!'); + e.preventDefault(); - const score = { - score: Math.floor(Math.random() * 100), - name: username.value - }; - highScores.push(score); - highScores.sort((a, b) => b.score - a.score); - highScores.splice(5); + const score = { + score: mostRecentScore, + name: username.value, + }; + highScores.push(score); + highScores.sort((a, b) => b.score - a.score); + highScores.splice(5); - localStorage.setItem("highScores", JSON.stringify(highScores)); - window.location.assign("/"); + localStorage.setItem('highScores', JSON.stringify(highScores)); + window.location.assign('/'); }; diff --git a/8. Save High Scores in Local Storage/end.js b/8. Save High Scores in Local Storage/end.js index e8eda3a..8e417b1 100644 --- a/8. Save High Scores in Local Storage/end.js +++ b/8. Save High Scores in Local Storage/end.js @@ -1,30 +1,30 @@ -const username = document.getElementById("username"); -const saveScoreBtn = document.getElementById("saveScoreBtn"); -const finalScore = document.getElementById("finalScore"); -const mostRecentScore = localStorage.getItem("mostRecentScore"); +const username = document.getElementById('username'); +const saveScoreBtn = document.getElementById('saveScoreBtn'); +const finalScore = document.getElementById('finalScore'); +const mostRecentScore = localStorage.getItem('mostRecentScore'); -const highScores = JSON.parse(localStorage.getItem("highScores")) || []; +const highScores = JSON.parse(localStorage.getItem('highScores')) || []; const MAX_HIGH_SCORES = 5; finalScore.innerText = mostRecentScore; -username.addEventListener("keyup", () => { - saveScoreBtn.disabled = !username.value; +username.addEventListener('keyup', () => { + saveScoreBtn.disabled = !username.value; }); -saveHighScore = e => { - console.log("clicked the save button!"); - e.preventDefault(); +saveHighScore = (e) => { + console.log('clicked the save button!'); + e.preventDefault(); - const score = { - score: Math.floor(Math.random() * 100), - name: username.value - }; - highScores.push(score); - highScores.sort((a, b) => b.score - a.score); - highScores.splice(5); + const score = { + score: mostRecentScore, + name: username.value, + }; + highScores.push(score); + highScores.sort((a, b) => b.score - a.score); + highScores.splice(5); - localStorage.setItem("highScores", JSON.stringify(highScores)); - window.location.assign("/"); + localStorage.setItem('highScores', JSON.stringify(highScores)); + window.location.assign('/'); }; diff --git a/9. Load and Display High Scores from Local Storage/end.js b/9. Load and Display High Scores from Local Storage/end.js index e8eda3a..8e417b1 100644 --- a/9. Load and Display High Scores from Local Storage/end.js +++ b/9. Load and Display High Scores from Local Storage/end.js @@ -1,30 +1,30 @@ -const username = document.getElementById("username"); -const saveScoreBtn = document.getElementById("saveScoreBtn"); -const finalScore = document.getElementById("finalScore"); -const mostRecentScore = localStorage.getItem("mostRecentScore"); +const username = document.getElementById('username'); +const saveScoreBtn = document.getElementById('saveScoreBtn'); +const finalScore = document.getElementById('finalScore'); +const mostRecentScore = localStorage.getItem('mostRecentScore'); -const highScores = JSON.parse(localStorage.getItem("highScores")) || []; +const highScores = JSON.parse(localStorage.getItem('highScores')) || []; const MAX_HIGH_SCORES = 5; finalScore.innerText = mostRecentScore; -username.addEventListener("keyup", () => { - saveScoreBtn.disabled = !username.value; +username.addEventListener('keyup', () => { + saveScoreBtn.disabled = !username.value; }); -saveHighScore = e => { - console.log("clicked the save button!"); - e.preventDefault(); +saveHighScore = (e) => { + console.log('clicked the save button!'); + e.preventDefault(); - const score = { - score: Math.floor(Math.random() * 100), - name: username.value - }; - highScores.push(score); - highScores.sort((a, b) => b.score - a.score); - highScores.splice(5); + const score = { + score: mostRecentScore, + name: username.value, + }; + highScores.push(score); + highScores.sort((a, b) => b.score - a.score); + highScores.splice(5); - localStorage.setItem("highScores", JSON.stringify(highScores)); - window.location.assign("/"); + localStorage.setItem('highScores', JSON.stringify(highScores)); + window.location.assign('/'); }; diff --git a/Quiz App Master/end.js b/Quiz App Master/end.js index e8eda3a..8e417b1 100644 --- a/Quiz App Master/end.js +++ b/Quiz App Master/end.js @@ -1,30 +1,30 @@ -const username = document.getElementById("username"); -const saveScoreBtn = document.getElementById("saveScoreBtn"); -const finalScore = document.getElementById("finalScore"); -const mostRecentScore = localStorage.getItem("mostRecentScore"); +const username = document.getElementById('username'); +const saveScoreBtn = document.getElementById('saveScoreBtn'); +const finalScore = document.getElementById('finalScore'); +const mostRecentScore = localStorage.getItem('mostRecentScore'); -const highScores = JSON.parse(localStorage.getItem("highScores")) || []; +const highScores = JSON.parse(localStorage.getItem('highScores')) || []; const MAX_HIGH_SCORES = 5; finalScore.innerText = mostRecentScore; -username.addEventListener("keyup", () => { - saveScoreBtn.disabled = !username.value; +username.addEventListener('keyup', () => { + saveScoreBtn.disabled = !username.value; }); -saveHighScore = e => { - console.log("clicked the save button!"); - e.preventDefault(); +saveHighScore = (e) => { + console.log('clicked the save button!'); + e.preventDefault(); - const score = { - score: Math.floor(Math.random() * 100), - name: username.value - }; - highScores.push(score); - highScores.sort((a, b) => b.score - a.score); - highScores.splice(5); + const score = { + score: mostRecentScore, + name: username.value, + }; + highScores.push(score); + highScores.sort((a, b) => b.score - a.score); + highScores.splice(5); - localStorage.setItem("highScores", JSON.stringify(highScores)); - window.location.assign("/"); + localStorage.setItem('highScores', JSON.stringify(highScores)); + window.location.assign('/'); }; From 2082d9ec92e0b74f16d989f291ee5be6941a1754 Mon Sep 17 00:00:00 2001 From: James Quick Date: Thu, 11 Jun 2020 11:24:16 -0500 Subject: [PATCH 3/3] rmeoved color from folder name --- .../app.css | 0 .../game.css | 0 .../game.html | 0 .../game.js | 0 .../index.html | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {4. Display Feedback for Correct:Incorrect Answers => 4. Display Feedback for Correct and Incorrect Answers}/app.css (100%) rename {4. Display Feedback for Correct:Incorrect Answers => 4. Display Feedback for Correct and Incorrect Answers}/game.css (100%) rename {4. Display Feedback for Correct:Incorrect Answers => 4. Display Feedback for Correct and Incorrect Answers}/game.html (100%) rename {4. Display Feedback for Correct:Incorrect Answers => 4. Display Feedback for Correct and Incorrect Answers}/game.js (100%) rename {4. Display Feedback for Correct:Incorrect Answers => 4. Display Feedback for Correct and Incorrect Answers}/index.html (100%) diff --git a/4. Display Feedback for Correct:Incorrect Answers/app.css b/4. Display Feedback for Correct and Incorrect Answers/app.css similarity index 100% rename from 4. Display Feedback for Correct:Incorrect Answers/app.css rename to 4. Display Feedback for Correct and Incorrect Answers/app.css diff --git a/4. Display Feedback for Correct:Incorrect Answers/game.css b/4. Display Feedback for Correct and Incorrect Answers/game.css similarity index 100% rename from 4. Display Feedback for Correct:Incorrect Answers/game.css rename to 4. Display Feedback for Correct and Incorrect Answers/game.css diff --git a/4. Display Feedback for Correct:Incorrect Answers/game.html b/4. Display Feedback for Correct and Incorrect Answers/game.html similarity index 100% rename from 4. Display Feedback for Correct:Incorrect Answers/game.html rename to 4. Display Feedback for Correct and Incorrect Answers/game.html diff --git a/4. Display Feedback for Correct:Incorrect Answers/game.js b/4. Display Feedback for Correct and Incorrect Answers/game.js similarity index 100% rename from 4. Display Feedback for Correct:Incorrect Answers/game.js rename to 4. Display Feedback for Correct and Incorrect Answers/game.js diff --git a/4. Display Feedback for Correct:Incorrect Answers/index.html b/4. Display Feedback for Correct and Incorrect Answers/index.html similarity index 100% rename from 4. Display Feedback for Correct:Incorrect Answers/index.html rename to 4. Display Feedback for Correct and Incorrect Answers/index.html