Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,140 --> 00:00:00,460
All right.
2
00:00:00,470 --> 00:00:02,400
Time for another challenge.
3
00:00:02,400 --> 00:00:05,970
Now currently we've got two inputs inside our form.
4
00:00:05,970 --> 00:00:09,470
One is called post body and one is called
5
00:00:09,480 --> 00:00:18,060
post title. And we know the inside our app.js we currently can log the post title that gets sent
6
00:00:18,240 --> 00:00:23,590
to our compose route through the post requests that the form initiates.
7
00:00:23,700 --> 00:00:27,980
So when we click the submit button we send over two pieces of data,
8
00:00:28,140 --> 00:00:30,910
the text area and the input.
9
00:00:31,140 --> 00:00:39,240
So if we wanted to we could console log the post body that's the text that's inside the text area as
10
00:00:39,240 --> 00:00:39,800
well.
11
00:00:40,080 --> 00:00:47,520
So now if I go ahead and head over to our compose page and refresh and I just type some stuff in here
12
00:00:48,020 --> 00:00:54,150
and I hit publish and I go over to my console then you can see that everything I just typed gets logged
13
00:00:54,150 --> 00:00:57,530
in here because I'm tapping into that variable
14
00:00:57,530 --> 00:01:02,600
post body which is what I defined inside the name for our text area.
15
00:01:03,060 --> 00:01:10,530
The next challenge is instead of console logging the post body or the post title inside this callback
16
00:01:10,530 --> 00:01:20,040
I want you to create a Javascript object that's simply just called post and it has to store both the
17
00:01:20,040 --> 00:01:25,530
title that gets passed over as well as the post body that gets passed over.
18
00:01:25,830 --> 00:01:29,450
So pause the video and try to complete that challenge.
19
00:01:31,530 --> 00:01:38,460
All right so if you've forgotten how Javascript objects look in terms of their syntax then take a look
20
00:01:38,610 --> 00:01:40,500
at my first hint.
21
00:01:40,560 --> 00:01:45,090
So this is how you would create a standard Javascript object.
22
00:01:45,090 --> 00:01:49,100
You would have a var keyword to show that you're creating a new variable.
23
00:01:49,470 --> 00:01:53,790
And then you would give your new object a name whatever it is you wish.
24
00:01:54,000 --> 00:01:58,630
And then you would have an equal sign and you would open up a set of curly braces.
25
00:01:58,690 --> 00:02:04,370
Now inside the curly braces you can have key value pairs and as many as you wish.
26
00:02:04,470 --> 00:02:10,199
You can even nest key value pairs as the value of a particular key.
27
00:02:10,530 --> 00:02:18,270
The parts in purple are the parts that you would need to change in order to create a custom object.
28
00:02:18,270 --> 00:02:22,460
So with this hint in mind now try and complete the challenge.
2941
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.