-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestionAndAnswers.js
149 lines (149 loc) · 6.06 KB
/
questionAndAnswers.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
export const questionAndAnswers = {
map: [
{
q: "What does map do?",
a: "Creates a new array populated with the results of calling the provided function on every element."
},
{
q: 'What does map return?',
a: 'map returns a new array.'
},
{
q: 'What parameters does the map method take?',
a: 'In most cases, the map method will just take a callback function as an argument.'
},
{
q: 'What parameters does the callback function take?',
a: `The callback function can take 3 parameters: <br/>
(1) the value of the current element<br/>
(2) the index of the current element<br/>
(3) the array the map method was called on`
}
],
filter: [
{
q: "What does filter do?",
a: "Returns an array with only the elements from the original array for which the callback function returns true."
},
{
q: 'What does filter return?',
a: 'filter returns an array.'
},
{
q: 'What parameters does the filter method take?',
a: 'In most cases, the filter method will just take a callback function as an argument.'
},
{
q: 'What parameters does the callback function take?',
a: `The callback function can take 3 parameters: <br/>
(1) the value of the current element<br/>
(2) the index of the current element<br/>
(3) the array the filter method was called on`
}
],
find: [
{
q: "What does find do?",
a: "Returns the first element for which the callback function returns true, or undefined if none are found."
},
{
q: 'What does find return?',
a: 'find returns a single element from the array. For example, if we have an array of strings, find will return a string.'
},
{
q: 'What parameters does the find method take?',
a: 'In most cases, the find method will just take a callback function as an argument.'
},
{
q: 'What parameters does the callback function take?',
a: `The callback function can take 3 parameters: <br/>
(1) the value of the current element<br/>
(2) the index of the current element<br/>
(3) the array the filter method was called on`
}
],
findIndex: [
{
q: "What does findIndex do?",
a: "Returns the index of the first element for which the callback function returns true, or undefined if none are found."
},
{
q: 'What does findIndex return?',
a: 'findIndex returns a number which represents an index in the array.'
},
{
q: 'What parameters does the findIndex method take?',
a: 'In most cases, the findIndex method will just take a callback function as an argument.'
},
{
q: 'What parameters does the callback function take?',
a: `The callback function can take 3 parameters: <br/>
(1) the value of the current element<br/>
(2) the index of the current element<br/>
(3) the array the filter method was called on`
}
],
findLast: [
{
q: "What does findLast do?",
a: "Returns the last element for which the callback function returns true, or undefined if none are found."
},
{
q: 'What does findLast return?',
a: 'findLast returns a single element from the array. For example, if we have an array of strings, find will return a string.'
},
{
q: 'What parameters does the findLast method take?',
a: 'In most cases, the findLast method will just take a callback function as an argument.'
},
{
q: 'What parameters does the callback function take?',
a: `The callback function can take 3 parameters: <br/>
(1) the value of the current element<br/>
(2) the index of the current element<br/>
(3) the array the filter method was called on`
}
],
findLastIndex: [
{
q: "What does findLastIndex do?",
a: "Returns the index of the last element for which the callback function returns true, or undefined if none are found."
},
{
q: 'What does findLastIndex return?',
a: 'findLastIndex returns a number which represents an index in the array.'
},
{
q: 'What parameters does the findLastIndex method take?',
a: 'In most cases, the findLastIndex method will just take a callback function as an argument.'
},
{
q: 'What parameters does the callback function take?',
a: `The callback function can take 3 parameters: <br/>
(1) the value of the current element<br/>
(2) the index of the current element<br/>
(3) the array the filter method was called on`
}
],
forEach: [
{
q: "What does forEach do?",
a: "Executes the callback function once for each array element."
},
{
q: 'What does forEach return?',
a: 'forEach only returns undefined.'
},
{
q: 'What parameters does the forEach method take?',
a: 'In most cases, the forEach method will just take a callback function as an argument.'
},
{
q: 'What parameters does the callback function take?',
a: `The callback function can take 3 parameters: <br/>
(1) the value of the current element<br/>
(2) the index of the current element<br/>
(3) the array the filter method was called on`
}
]
};