-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquiz.js
181 lines (167 loc) · 3.6 KB
/
quiz.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
const quizlist = [
{
id: 1,
question: "What method would you use to add an element to the end of an array?",
correctanswer: "push()",
option: [
"push()",
"add()",
"append()",
"insert()",
],
},
{
id: 2,
question: "What method would you use to remove the last element from an array?",
correctanswer: "pop()",
option: [
"remove()",
"pop()",
"delete()",
"shift()",
],
},
{
id: 3,
question: "What method would you use to add an element to the beginning of an array?",
correctanswer: "unshift()",
option: [
"prepend()",
"insert()",
"add()",
"unshift()",
],
},
{
id: 4,
question: "What method would you use to remove the first element from an array?",
correctanswer: "shift()",
option: [
"shift()",
"remove()",
"delete()",
"pop()",
],
},
{
id: 5,
question: "What method would you use to find the index of a specific element in an array?",
correctanswer: "indexOf()",
option: [
"find()",
"indexOf()",
"index()",
"search()",
],
},
{
id: 6,
question: "What method would you use to remove an element from an array by its index?",
correctanswer: "splice()",
option: [
"delete()",
"splice()",
"pop()",
"remove()",
],
},
{
id: 7,
question: "What method would you use to join all elements of an array into a string?",
correctanswer: "join()",
option: [
"connect()",
"join()",
"merge()",
"concat()",
],
},
{
id: 8,
question: "What method would you use to create a new array with all elements that pass a certain test?",
correctanswer: "filter()",
option: [
"select()",
"where()",
"search()",
"filter()",
],
},
{
id: 9,
question: "What method would you use to create a new array with the results of calling a function on every element?",
correctanswer: "map()",
option: [
"map()",
"iterate()",
"transform()",
"mutate()",
],
},
{
id: 10,
question: "What method would you use to sort the elements of an array?",
correctanswer: "sort()",
option: [
"order()",
"arrange()",
"group()",
"sort()",
],
},
{
id: 11,
question: "What higher-order function would you use to create a new array with only the elements that pass a certain test?",
correctanswer: "filter()",
option: [
"filter()",
"map()",
"reduce()",
"forEach()",
],
},
{
id: 12,
question: "What higher-order function would you use to create a new array with the results of calling a function on every element?",
correctanswer: "map()",
option: [
"filter()",
"map()",
"reduce()",
"forEach()",
],
},
{
id: 13,
question: "What higher-order function would you use to combine all elements of an array into a single value?",
correctanswer: "reduce()",
option: [
"map()",
"filter()",
"reduce()",
"forEach()",
],
},
{
id: 14,
question: "What higher-order function would you use to loop over the elements of an array?",
correctanswer: "forEach()",
option: [
"map()",
"filter()",
"reduce()",
"forEach()",
],
},
{
id: 15,
question: "What higher-order function would you use to sort the elements of an array?",
correctanswer: "sort()",
option: [
"sort()",
"order()",
"arrange()",
"group()",
],
},
];