Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,540 --> 00:00:08,370
All right. Time for challenge 13. The goal of this challenge is such that when you head over to the compose
2
00:00:08,370 --> 00:00:16,890
page and you create a number of posts, one is called Day 1, one's called Day 2, one's called day 3 and then you hit publish
3
00:00:16,980 --> 00:00:18,780
and you publish all three posts,
4
00:00:18,780 --> 00:00:20,450
you have to do this three times.
5
00:00:20,550 --> 00:00:28,780
But at this point if you head over to your terminal you should see each of the post titles printed out.
6
00:00:28,860 --> 00:00:35,040
So the first time when I created a post, it only printed out the first title, the second time it printed
7
00:00:35,130 --> 00:00:41,920
the first and the second title and a third time just now it printed all three titles that I've created.
8
00:00:42,060 --> 00:00:51,200
This is no longer the entire posts array but it's actually posting each and every title inside the array.
9
00:00:51,540 --> 00:00:58,860
So in order to do this, you'll need to write a FOR loop inside the homeeks that loops through this
10
00:00:58,920 --> 00:01:04,190
post array and console logs each and every title,
11
00:01:04,319 --> 00:01:11,520
the titles of each of these posts. And to test it you should have a minimum of two posts so that you
12
00:01:11,520 --> 00:01:18,800
can make sure that you are indeed printing out all of the titles inside the posts array. Pause the video and complete
13
00:01:18,830 --> 00:01:20,400
this challenge.
14
00:01:20,450 --> 00:01:22,990
All right here comes my first hint.
15
00:01:23,030 --> 00:01:25,510
Now remember that to create a FOR loop
16
00:01:25,550 --> 00:01:33,350
this is the standard format. And you first start off from zero and then you put an upper bound when you
17
00:01:33,350 --> 00:01:35,060
want the FOR loop to stop,
18
00:01:35,060 --> 00:01:37,470
so how many times do you want the loop to run.
19
00:01:37,880 --> 00:01:43,310
Then you increment through the FOR loop one at a time and that allows you to tap into this thing called
20
00:01:43,410 --> 00:01:48,880
i which will change from 0 to 1 to 2 until the upper bound.
21
00:01:48,980 --> 00:01:55,160
And this means that if you add an array then you can tap into the zeroth item, the first, the second, the
22
00:01:55,160 --> 00:02:00,920
third and that means you can loop through the array and do whatever it is you need with each of the
23
00:02:00,920 --> 00:02:02,940
items inside the array.
24
00:02:03,290 --> 00:02:08,210
So see if that's enough of a hint for you to be able to complete this challenge.
25
00:02:09,240 --> 00:02:18,570
Now my second hnt is that in our case, the upper bound inside our FOR loop will be the number of posts inside
26
00:02:18,630 --> 00:02:19,880
our posts array.
27
00:02:20,130 --> 00:02:26,900
If there's only one item inside posts array then the upper bound will simply be one
28
00:02:27,210 --> 00:02:33,770
and if there's 10 items inside our posts array, then the upper bound will be 10.
29
00:02:33,840 --> 00:02:40,270
In order to do that dynamically remember you can tap into array.lent,h so posts.length.
30
00:02:40,440 --> 00:02:42,470
I hope that's enough of a hint for you to be able to
31
00:02:42,480 --> 00:02:44,100
now complete the challenge.
3460
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.