Skip to content

Commit fcf026a

Browse files
committed
add content to repo
1 parent df4dad6 commit fcf026a

File tree

14 files changed

+504
-2
lines changed

14 files changed

+504
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vscode

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1-
# coding_bc_webAPI_CodeQuiz
1+
# 04 Web APIs: Code Quiz
22

3-
Reference: https://www.youtube.com/watch?v=AFTvxsVv52k
3+
This project involved building a timed multiple choice quiz with JavaScript utilizing the Document Object Model, or DOM. It also involved setting data into Local Storage and retrieving it to display high scores from past attempts at the quiz.
4+
5+
## Application Screenshot
6+
7+
![Start Page](https://raw.github.com/rwaynewhite15/rwhite-challenge-4/main/assets/Start.png)
8+
9+
![Rules](https://raw.github.com/rwaynewhite15/rwhite-challenge-4/main/assets/Rules.png)
10+
11+
![Question](https://raw.github.com/rwaynewhite15/rwhite-challenge-4/main/assets/Question.png)
12+
13+
![Finish](https://raw.github.com/rwaynewhite15/rwhite-challenge-4/main/assets/Finish.png)
14+
15+
![High Scores](https://raw.github.com/rwaynewhite15/rwhite-challenge-4/main/assets/HighScores.png)
16+
17+
[Go to Application](https://rwaynewhite15.github.io/rwhite-challenge-4/)
18+
19+
Bobby White

REF.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# coding_bc_webAPI_CodeQuiz
2+
3+
Reference: https://www.youtube.com/watch?v=AFTvxsVv52k

assets/Finish.png

54.2 KB
Loading

assets/HighScores.png

32.1 KB
Loading

assets/Question.png

78.5 KB
Loading

assets/Rules.png

96.5 KB
Loading

assets/Start.png

36.3 KB
Loading

assets/highscores.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const highScoresText = document.querySelector("#high-scores");
2+
let highScoresTag = '';
3+
4+
5+
for (let i = 0; i < localStorage.length; i++) {
6+
highScoreData = JSON.parse(localStorage.getItem(i+1));
7+
highScoresTag = highScoresTag.concat('</br><div id="high-scores">'+ highScoreData.initials + " "+"-"+" " + highScoreData.score +'</div>');
8+
};
9+
10+
highScoresText.innerHTML = highScoresTag;

assets/quiz.js

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
//Quiz Questions
2+
let questions = [
3+
{
4+
quizNumb: 1,
5+
question: "Which of the following terminal commands creates an empty html file within the folder named 'test'?",
6+
answer: "touch ./test/index.html",
7+
options: [
8+
"cd test/index.html",
9+
"touch ./test/index.html",
10+
"mv ./test/test2 ./test/index.html",
11+
"mkdir test/index.html"
12+
]
13+
},
14+
{
15+
quizNumb: 2,
16+
question: "Which statement is not correct about HTML?",
17+
answer: "HTML is used to add styling to the elements in a webpage.",
18+
options: [
19+
"HTML stands for Hyper Text Markup Language.",
20+
"HTML can be used to build the structure of a webpage.",
21+
"HTML is used to add styling to the elements in a webpage.",
22+
"HTML allows us to define elements like paragraphs, images, links, and forms.",
23+
]
24+
},
25+
{
26+
quizNumb: 3,
27+
question: "Which of the following Git Commands creates a branch?",
28+
answer: "git checkout -b <branch name>",
29+
options: [
30+
"git checkout -b <branch name>",
31+
"git pull origin <branch name>",
32+
"git commit -m <branch name>",
33+
"git fetch <branch name>",
34+
]
35+
},
36+
{
37+
quizNumb: 4,
38+
question: "________ is the scripting or programming language that allows you to implement complex features on web pages.",
39+
answer: "Javascript",
40+
options: [
41+
"CSS",
42+
"API",
43+
"Javascript",
44+
"HTML",
45+
]
46+
},
47+
{
48+
quizNumb: 5,
49+
question : "The _______ allows you to manipulate HTML and CSS, creating, removing and changing HTML.",
50+
answer: "DOM API",
51+
options: [
52+
"Geolocation API",
53+
"DOM API",
54+
"WebGL API",
55+
"None of the above",
56+
]
57+
},
58+
{
59+
quizNumb: 6,
60+
question : "Which of the following examples is not a valid variable name for Javascript?",
61+
answer: "10cent",
62+
options: [
63+
"$here",
64+
"_name",
65+
"sort135",
66+
"10cent",
67+
]
68+
},
69+
{
70+
quizNumb: 7,
71+
question : "What is the correct Javascript syntax to access 2 in the array? const random = ['squid', 795, [0, 1, 2]];",
72+
answer: "random[2][2]",
73+
options: [
74+
"random(0,3)",
75+
"console.log(random);",
76+
"random[2][2]",
77+
"console.log(random.length);",
78+
]
79+
},
80+
{
81+
quizNumb: 8,
82+
question : "Which of the following does not remove an element from an array?",
83+
answer: "push()",
84+
options: [
85+
"pop()",
86+
"shift()",
87+
"splice()",
88+
"push()",
89+
]
90+
},
91+
{
92+
quizNumb: 9,
93+
question : "which of the following describes the Javascript function best?",
94+
answer: "The function definition is also called the function declaration.",
95+
options: [
96+
"The function definition is also called the function declaration.",
97+
"The function consists of the name of the function, and parameters, separated by semi-colon and enclosed in curly braces.",
98+
"Parameters are essentially passed to functions by variable.",
99+
"All of the above.",
100+
]
101+
},
102+
{
103+
quizNumb: 10,
104+
question : "Which of the following instance method combines the text of two (or more) strings and returns a new string?",
105+
answer: "String.prototype.concat()",
106+
options: [
107+
"String.prototype.includes()",
108+
"String.prototype.concat()",
109+
"String.prototype.at()",
110+
"String.prototype.substring()",
111+
]
112+
}
113+
];

0 commit comments

Comments
 (0)