You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -24,7 +24,7 @@ Watch the embedded scrim, and complete the task on the timeline (the little ghos
24
24
> [!NOTE]
25
25
> This task is somewhat of a stretch goal, given that it relies on JavaScript features you've not yet explicitly covered during the course. Give it your best shot, and search online for information on anything you are not sure about.
26
26
27
-
## Task 1
27
+
## Arrays 1
28
28
29
29
This task gives you some basic array practice:
30
30
@@ -34,11 +34,11 @@ This task gives you some basic array practice:
para2.textContent=`The length of the array is ${arrayLength}.`;
176
+
constpara3=document.createElement("p");
177
+
para3.textContent=`The last item in the array is "${lastItem}".`;
178
+
section.appendChild(para1);
179
+
section.appendChild(para2);
180
+
section.appendChild(para3);
181
+
```
182
+
135
183
</details>
136
184
137
-
## Task 3
185
+
## Arrays 3
138
186
139
187
For this array task, we provide you with a starting array, and you will work in somewhat the opposite direction. You need to:
140
188
@@ -143,6 +191,12 @@ For this array task, we provide you with a starting array, and you will work in
143
191
3. Iterate over each item in the array and add its index number after the name inside parentheses, for example `Ryu (0)`. Note that we don't teach how to do this in the Arrays article, so you'll have to do some research.
144
192
4. Finally, join the array items together in a single string called `myString`, with a separator of `"-"`.
145
193
194
+
The starting point of the task looks like this (nothing is shown yet):
195
+
196
+
{{ EmbedLiveSample("arrays-3", "100%", 60) }}
197
+
198
+
Here's the underlying code for this starting point:
For this array task, we provide you with a starting array listing the names of some birds.
208
296
@@ -211,7 +299,11 @@ To complete the task:
211
299
1. Find the index of the `"Eagles"` item, and use that to remove the `"Eagles"` item.
212
300
2. Make a new array from this one, called `eBirds`, that contains only birds from the original array whose names begin with the letter "E". Note that {{jsxref("String.prototype.startsWith()", "startsWith()")}} is a great way to check whether a string starts with a given character.
213
301
214
-
If it works, you should see `"Emus,Egrets"` appear in the page.
302
+
The starting point of the task looks like this (nothing is shown yet):
303
+
304
+
{{ EmbedLiveSample("arrays-4", "100%", 60) }}
305
+
306
+
Here's the underlying code for this starting point:
0 commit comments